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

Join Date
Dec 2012
Posts
5
Rep Power
0

#### 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.
Code:
`w.create_line(0, 0, 0, 0)`
Any suggestions?
2. I draw in 3 dimensions using homogeneous coordinates with supporting functions for
Code:
```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,
worldTransform,perspectiveTransform,pageTransform):

class Transform:
'''matrix_multipy(point,xform)'''
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):
'''transformObject.reflection((AxisX,AxisZ))'''
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.