This example shows how to use "command" in button to call a function with or without parameters
1. Import tkinter
2. build a window named "win".
3. window format 1: title()
4. window format 2: geometry() determine size and initial position(x,y)
5. window format 3: maxsize() set max size of a window
6. Build Label component and give a string to text
7. Build close_win function to end the window
8. Build add_label_num function to deliver paramters for increasing the text of the label and use lbl.config to change the label status
9. Build Button component and give a string to text, and use command to call the function
10. Build Button component and give a string to text, and use command to call the function with parameters
11. Use pack to arrange Button on bottom side
12. Use pack to arrange Button on left side
13. Use pack to arrange Build Label on right side
14. use mainloop() to keep window running for monitoring and handling events
這個範例說明如何使用Button中的command呼叫有參數以及無參數的函數。
We will share more tutorial videos with people who want to learn LabVIEW and Python welcome to subscribe this channel.
未來會陸續更新影片,讓想學習LabVIEW和Python的朋友可以看影片學習,歡迎訂閱此頻道。
其他網址/related websites:
https://labview-tech.blogspot.com/
https://fishark.pixnet.net/blog
email: jacklee3633 @gmail.com
Line: lvnet
留言列表