Tkinter and Graphics

jmdeschamps jmdeschamps at cvm.qc.ca
Mon Nov 15 10:45:15 EST 2004


aleaxit at yahoo.com (Alex Martelli) wrote in message news:<1gn98g2.1uhohpdpev85hN%aleaxit at yahoo.com>...
> Andrew <nobody at hotmail.com> wrote:
> 
> > Hi I was wondering if there is anyway in Tkinter to create GUIs using
> > Graphics, like windows media player or other tools like that
> 
> I guess you could do just about anything with Canvas, it that's what you
> mean.
> 
> 
> Alex

Such as this (below)
(I made this while reading as an refresher for myself, since I'm doing
mostly CGI and web related stuff these days!)

Good interface design!!!

JM

################ 
import Tkinter

bar = 1
cursing = True

def foo(s):
	global bar
	print bar
	bar += 1
	
def baz(s):
	global cursing,rCanvas
	if cursing :
		cursing = False
		rCanvas.config(cursor="pirate")
	else:
		cursing = True
		rCanvas.config(cursor="")

root = Tkinter.Tk()
rCanvas=Tkinter.Canvas(root, background="white")
idPoly=rCanvas.create_polygon(10,10,10,200,150,250,50,100)
rCanvas.tag_bind(idPoly,"<Button-1>",foo)
rCanvas.tag_bind(idPoly,"<Enter>",baz)
rCanvas.tag_bind(idPoly,"<Leave>",baz)
rCanvas.pack()
root.mainloop()
###############



More information about the Python-list mailing list