Python window.destroy()?

ns56645 ns56645 at swt.edu
Mon Feb 21 21:10:48 EST 2000


Jerry Thanks for your help,

To give you the complete picture I have send you my program. I need to
kill  two new windows that were created when I moved my mouse on the
window.

See to the program and you can get the picture. I am still in the lab
for
another hour.

Thanks,


#!/usr/bin/python

from Tkinter import *


class App:


def __init__(self,master):

frame=Frame(master)

frame.pack()


self.button1 = Button(frame,text="Button1")
   self.button1.pack(side=LEFT)


self.button2 = Button(frame,text="Button2")
   self.button2.pack(side=RIGHT)


self.Quit= Button(frame,text="QUIT",command=frame.quit)
   self.Quit.pack(side=LEFT)


def myEcho2(event):

wm1=Toplevel()

wm1.label=Label(wm1,text="Mouse is on the 2nd button")
    wm1.label.pack()


def myEcho1(event):

wm2=Toplevel()

wm2.label=Label(wm2,text="Mouse is on the 1st button")
    wm2.label.pack()

   self.button2.bind("<Enter>",myEcho2)

self.button2.pack()


self.button1.bind("<Enter>",myEcho1)

self.button1.pack()


self.button2.bind("<Leave>",wm2.destroy)

self.button2.pack()

   self.button1.bind("<Leave>",wm1.destroy)
   self.button1.pack()
root=Tk()

app = App(root)

root.mainloop()







More information about the Python-list mailing list