0
這裏開幕式是我的代碼:窗口中的Tkinter
#!/usr/bin/python
from Tkinter import *
def openWindowReasons():
global win
win = Tk()
win.title("Decem Rationes Computerum Programmandorum")
buttonMaker("I", 1, 1, " I) Programmo computeres ne meus animus deceat ignavus.") #create buttons 1-10
buttonMaker("II", 2, 1, " II) Programmo computeres ut relaxem post scholam et gaudeam scholam esse perfectam.")
buttonMaker("III", 3, 1, " III) Meo amico programmato programmo ut certem cum eo.")
buttonMaker("IV", 4, 1, " IV) Alii homines qui boni porgrammi programmant ut facian pecuniam.")
buttonMaker("V", 5, 1, " V) Alii homines scribunt tantam codem ut alii cogitent eos esse optimos.")
buttonMaker("VI", 1, 3, " VI) Programmare est tam iocus ut sperem me programmaturum esse saepius.")
buttonMaker("VII", 2, 3, " VII) Multi homines programmant tam ut non habent tempus faciendorum pensorum quod sunt quam insulso.")
buttonMaker("VIII", 3, 3, " VIII) Programmo ut possim loqui de eo cum meis amicis.")
buttonMaker("IX", 4, 3, " IX) Me inspirato ab caeteris programmo ut sim similaris eis.")
buttonMaker("X", 5, 3, " X) Saepe programmo ne habeam audire mea matri quae dictit quam multa.")
label_1 = Label(win, text="RATIONES")
label_1.grid(row=3, column=2)
def buttonMaker(a, b, c, d):
f = "button" + a
f= Button(win, text=a, commmand=openWindowR(str(d)))
f.grid(row=int(b), column=int(c))
def openWindowR(d):
newWin = Tk()
newWin.title(str(d))
g = "label" + d
g = Label(newWin, text=str(d))
g.grid(row=3, column=3)
def openWindowAlt():
newWin_1 = Toplevel()
label_2 = Label(newWin_1, text="Magister Bartoloma tam sapiens ut Minerva, quae dea sapientae est, eum admiretur.")
root = Tk() #create parent window
root.title("Main Page")
label = Label(root, text="Decem Rationes Computerum Programmandorum")
label.grid(row=1, column=2)
button = Button(root, text="Decem Rationes", commmand=openWindowReasons())
button.grid(row=3, column=3)
button_1= Button(root, text="Pleasant Alternative", commmand=openWindowAlt())
button_1.grid(row=3, column=1)
root.mainloop()
我每次運行它打開所有的窗戶在一次,而當用戶按下按鈕的代碼...任何幫助將是非常感謝...
感謝,你能告訴我,我怎麼會合並類到它 – user2350801 2013-05-04 22:08:50
還,怎麼會是如何變化的職能的工作? – user2350801 2013-05-04 22:12:19
@unubtu我看了你的答案片刻,如果沒有刪除,我會upvote它!我認爲它比我更清楚地解釋了這個問題。 – 2013-05-04 22:14:27