ciao a tutti, sto cominciando a dare un'occhiata a python e stavo provando qualche esempio con Tkinter. Ho scritto il mio codice, ho installato python (linux) e ho provato a lanciare l'esempio con python test.py solo che mi da un errore, è il seguente:
side@linuxbox:~# python test.py
File "test.py", line 5
def_scrivi_messaggio(self):
^
IndentationError: expected an indented block
la linea 5 corrisponde a:
def_scrivi_messaggio(self):
ho sfrugugliato sul sito python.org ma la linea 5 risulta essere giusta :master: cosa c'è di sbagliato ??
se necessita questo è l'intero codice del mio test:
grazie 1000codice:from Tkinter import * class Application(Frame): def_scrivi_messaggio(self): self.mess["text"] = "Ciao a tuttiiiii", def cancella_messaggio(self): self.mess["text"] = "", def__init__(self, master=None): f = Frame(master) f.pack() self.esci = Button(f) self.esci["text"] = "QUIT" self.esci["fg"] = "red" self.esci["command"] = f.quit self.esci.pack({"side": "left"}) self.butt_mess = Button(f) self.butt_mess["text"] = "Scrivi", self.butt_mess["command"] = self.scrivi_messaggio self.butt_mess.pack({"side": "left"}) self.butt_canc_mess = Button(f) self.butt_canc_mess["text"] = "Cancella", self.butt_canc_mess["command"] = self.cancella_messaggio self.butt_canc_mess.pack({"side": "left"}) self.mess = Message(f) self.mess["text"] = "", self.mess.pack({"side": "left"}) finestra = Tk() app = Application(finestra) finestra.mainloop()![]()