- 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()
推薦閱讀
- 零基礎(chǔ)學(xué)Visual C++第3版
- Maven Build Customization
- Cocos2d-x游戲開發(fā):手把手教你Lua語言的編程方法
- Java應(yīng)用開發(fā)與實(shí)踐
- 青少年軟件編程基礎(chǔ)與實(shí)戰(zhàn)(圖形化編程三級(jí))
- Getting Started with SQL Server 2012 Cube Development
- 軟件測試技術(shù)指南
- Mastering ArcGIS Enterprise Administration
- Geospatial Development By Example with Python
- 大數(shù)據(jù)時(shí)代的企業(yè)升級(jí)之道(全3冊(cè))
- IPython Interactive Computing and Visualization Cookbook
- AI自動(dòng)化測試:技術(shù)原理、平臺(tái)搭建與工程實(shí)踐
- SCRATCH編程課:我的游戲我做主
- 和孩子一起學(xué)編程:用Scratch玩Minecraft我的世界
- Ubuntu Server Cookbook