[Python] tkinter di esempio che si blocca

2010-12-20 Per discussione Massimo Capanni
Salve a tutti,

sto iniziando a studiarmi Tkinter da alcune risorse in rete.
Premetto che sto facendomi le ossa con Python ver. 3.1.3 su
piattaforma Windows Xp.
Il seguente esempio ha un funzionamento anomalo e non capisco perche':
se premo 'hello' funziona correttamente,
se premo QUIT il prompt viene restituito nella shell ma la finestra di
Tk si blocca:

from tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()

self.button = Button(frame, text=QUIT, fg=red, command=frame.quit)
self.button.pack(side=LEFT)

self.hi_there = Button(frame, text=Hello, command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):
print(hi there, everyone!)

root = Tk()
app = App(root)
root.mainloop()

avete idea del motivo?
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] tkinter di esempio che si blocca

2010-12-20 Per discussione crap0101
Il giorno lun, 20/12/2010 alle 22.58 +0100, Massimo Capanni ha scritto:

 se premo QUIT il prompt viene restituito nella shell ma la finestra di
 Tk si blocca:
 [...]
quit() ti fa uscire dal mainloop, però se vuoi distruggere la finestra
devi chiamare destroy()



-- 
me - http://crap0101.gnu-darwin.org/


signature.asc
Description: Questa è una parte del messaggio firmata digitalmente
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python