Ahoj
v nasledujicim kodu mi tlacitko (tlac_spocti) automaticky spousti prikaz (funkce spocti - vykresleni toplevel okna c) a tlacitko se ani nevykresli.
Diky za radu.
??
import Tkinter as Tk
class radek_pneu:
def __init__(self,frame,text):
popis = Tk.Label(frame,text=text)
popis.pack(padx=5,pady=5,side="left")
R = Tk.Entry(frame,width=2)
R.pack(side="right")
er = Tk.Label(frame,text=" R")
er.pack(side="right")
vyska = Tk.Entry(frame,width=2)
vyska.pack(side="right")
lomitko = Tk.Label(frame,text="/")
lomitko.pack(side="right")
self.sirka = Tk.Entry(frame,width=3)
self.sirka.pack(side="right")
class App:
def __init__(self,master_frame):
master = Tk.Frame(master_frame)
master.pack()
frame_1 = Tk.Frame(master)
frame_2 = Tk.Frame(master)
frame_1.pack(anchor="w",fill="x")
frame_2.pack(anchor="w")
self.aktualni = radek_pneu(frame_1,u"Zadej aktualni rozm?ry:")
self.maximalni = radek_pneu(frame_2,u"Zadej maxim?ln? rozm?ry:")
tlac_spocti = Tk.Button(master,text="Spo??tej",command=self.spocti())
tlac_spocti.pack(side="right")
def spocti(self):
w1=self.aktualni.sirka.get()
c = Tk.Toplevel()
c.title(w1)
c.mainloop()
#------------------------------------------------------------------------
if __name__ == "__main__":
hl_okno = Tk.Tk()
hl_okno.title("Rychlosti")
app = App(hl_okno)
hl_okno.mainloop()
??