看板 [ Python ]
討論串[問題] tkinter command 傳參數問題
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者timTan (用口頭禪區分年記)時間14年前 (2012/01/20 01:45), 編輯資訊
0
0
0
內容預覽:
這裡我覺得用closure 有點難懂。. 你可以參考一下functools.. import functools. def myfun(i):. return i. commands = []. for i in range(3):. commands.append(functools.partia
(還有137個字)

推噓0(0推 0噓 2→)留言2則,0人參與, 最新作者kfrico (霧峰小霸王)時間14年前 (2012/01/19 16:56), 編輯資訊
0
0
0
內容預覽:
for i in range(0,3):. g[i]=tk.Button(sf,text = '按鈕',command=lambda:myfunction(i)). g[i].grid(row=row_num,column=3). 為什麼在myfunction接收參數時都是2. 是我寫錯那裡嗎?.
首頁
上一頁
1
下一頁
尾頁