| 1 | from Tkinter import *
|
|---|
| 2 |
|
|---|
| 3 | class Test(Frame):
|
|---|
| 4 | def printit(self):
|
|---|
| 5 | print "hi"
|
|---|
| 6 |
|
|---|
| 7 | def createWidgets(self):
|
|---|
| 8 | self.QUIT = Button(self, text='QUIT',
|
|---|
| 9 | background='red',
|
|---|
| 10 | foreground='white',
|
|---|
| 11 | height=3,
|
|---|
| 12 | command=self.quit)
|
|---|
| 13 | self.QUIT.pack(side=BOTTOM, fill=BOTH)
|
|---|
| 14 |
|
|---|
| 15 | self.canvasObject = Canvas(self, width="5i", height="5i")
|
|---|
| 16 | self.canvasObject.pack(side=LEFT)
|
|---|
| 17 |
|
|---|
| 18 | def mouseDown(self, event):
|
|---|
| 19 | # canvas x and y take the screen coords from the event and translate
|
|---|
| 20 | # them into the coordinate system of the canvas object
|
|---|
|
|---|