- Tkinter GUI Programming by Example
- David Love
- 88字
- 2021-08-27 18:49:08
Creating Tkinter-compatible variables
So, how would we go about using a variable to update this label? Tkinter comes with four built-in variable objects for us to handle different data types:
- StringVar: This holds characters like a Python string.
- IntVar: This holds an integer value.
- DoubleVar: This holds a double value (a number with a decimal place).
- BooleanVar: This holds a Boolean to act like a flag.
To create a variable, just instantiate it like any other class. These do not require any arguments. For example:
label_text = tk.StringVar()
推薦閱讀
- Intel Galileo Essentials
- Python從入門到精通(精粹版)
- Learning ArcGIS Pro
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- R Deep Learning Cookbook
- C程序設計實踐教程
- Nginx Lua開發實戰
- Learning Docker Networking
- Odoo 10 Implementation Cookbook
- OpenStack Networking Essentials
- Modern C++ Programming Cookbook
- Mastering Docker
- Raspberry Pi Robotic Projects
- ASP.NET Core 2 High Performance(Second Edition)
- Visual C++程序開發范例寶典