1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Rep Power

    Python Tkinter canvas

    I need to create vector diagram using canvas widget and lines.
    But how to make the trick to get start point in the centre of canvas?
    I want, that zerro point is cetred to later make negative values as well.
    w.create_line(0, 0, 0, 0)
    Any suggestions?
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power
    I draw in 3 dimensions using homogeneous coordinates with supporting functions for
    def homogenize(x=(0,),y=None,z=None,t=None):
            generate homogeneous coordinates from lists of AxisX coordinates,
            with optional lists of y, z, or t.    These must all be the same length
    def computeCoordinates(vertex,
    class Transform:
        def __init__(self):
            self.xform = identity(4)
        def copy(self):
        def XForm(self,points):
        def matrix(self,m):
                    concatenate the matrix m
        def replace(self,m):
        def swap(self,axis1,axis2):
        def concat(self,m):
        def reflect(self,axisList):
        def rotate(self,z=0,xp=0,zpp=0):
        def scale(self,sx=1,sy=1,sz=1,st=1):
        def shear(self,xy=0,xz=0,yx=0,yz=0,zx=0,zy=0):
        def stretch(self,sx=1,sy=1,sz=1):
        def translate(self,tx=0,ty=0,tz=0):
        def perspect(self,FOV,zn,zf):
    In other words, use an intermediate step to transform from your world coordinates to the canvas coordinates.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo