cpython/Demo/tkinter/matt/canvas-demo-simple.py

29 lines
749 B
Python
Raw Normal View History

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