1994-10-07 09:55:26 +00:00
|
|
|
from Tkinter import *
|
|
|
|
|
|
|
|
# this program creates a canvas and puts a single polygon on the canvas
|
|
|
|
|
|
|
|
class Test(Frame):
|
|
|
|
def printit(self):
|
|
|
|
print "hi"
|
|
|
|
|
|
|
|
def createWidgets(self):
|
1996-07-30 18:57:18 +00:00
|
|
|
self.QUIT = Button(self, text='QUIT', foreground='red',
|
|
|
|
command=self.quit)
|
|
|
|
self.QUIT.pack(side=BOTTOM, fill=BOTH)
|
1994-10-07 09:55:26 +00:00
|
|
|
|
1996-07-30 18:57:18 +00:00
|
|
|
self.draw = Canvas(self, width="5i", height="5i")
|
1994-10-07 09:55:26 +00:00
|
|
|
|
|
|
|
# see the other demos for other ways of specifying coords for a polygon
|
1996-07-30 18:57:18 +00:00
|
|
|
self.draw.create_rectangle(0, 0, "3i", "3i", fill="black")
|
1994-10-07 09:55:26 +00:00
|
|
|
|
1996-07-30 18:57:18 +00:00
|
|
|
self.draw.pack(side=LEFT)
|
1994-10-07 09:55:26 +00:00
|
|
|
|
|
|
|
def __init__(self, master=None):
|
|
|
|
Frame.__init__(self, master)
|
|
|
|
Pack.config(self)
|
|
|
|
self.createWidgets()
|
|
|
|
|
|
|
|
test = Test()
|
|
|
|
|
|
|
|
test.mainloop()
|