- 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()
推薦閱讀
- 劍指JVM:虛擬機實踐與性能調(diào)優(yōu)
- Mastering ServiceNow(Second Edition)
- iOS開發(fā)實戰(zhàn):從入門到上架App Store(第2版) (移動開發(fā)叢書)
- Microsoft Azure Storage Essentials
- Tableau 10 Bootcamp
- 21天學通C++(第5版)
- C++程序設(shè)計教程(第2版)
- NGUI for Unity
- Web開發(fā)的平民英雄:PHP+MySQL
- Get Your Hands Dirty on Clean Architecture
- JBoss AS 7 Development
- 優(yōu)化驅(qū)動的設(shè)計方法
- Unity 3D UI Essentials
- Game Programming using Qt 5 Beginner's Guide
- PHP高性能開發(fā):基礎(chǔ)、框架與項目實戰(zhàn)