-
-
Notifications
You must be signed in to change notification settings - Fork 101
Variable Property
Some interactive tkinter widgets have properties named variable or textvarible. Those properties can contain control variables, objects used to control the value behind the widget.
To define a variable, just put the variable's name in the property editor. Use the combo box to specify the type: StringVar, IntVar, DoubleVar or BooleanVar; StringVar is the default. See the tkinter documentation about how a widget manages each type.
You can link a "tkvariable" to a slider or entry widget and then programmatically access the changing value. These variables will be uninitialized until the user first operates the control.
In code, you can retrieve a reference of the tkinter variable using the builder method get_variable(name)
Add the following line to the generated Python code.
print('current value is ' , self.builder.get_variable('radiovar').get())
When you pull the slider back and forth with the mouse, it will print different numbers.
Interface file: controlvariables.ui
Full example code: controlvariables.py
- Requirements
- Installation
- Launch
- Screens:
- Step-by-Step Examples:
- Completed Examples
- Tips
- Additional widget sets
- Known Issues
- FAQ
- Troubleshooting:
- Communicating: