We will create a DoubleVar of tkinter variable and add a float number literal to it using the + operator. After that, we will look at the resulting Python type.
Here are the steps to see the different tkinter data types:
- Create a new Python module and name it GUI_PyDoubleVar_to_Float_Get.py.
- At the top of the GUI_PyDoubleVar_to_Float_Get.py module, import tkinter:
import tkinter as tk
- Create an instance of the tkinter class:
win = tk.Tk()
- Create a DoubleVar and give it a value:
doubleData = tk.DoubleVar()print(doubleData.get())doubleData.set(2.4)print(type(doubleData))add_doubles = 1.222222222222222222222222 + doubleData.get()print(add_doubles)print(type(add_doubles))
- The following screenshot shows the final GUI_PyDoubleVar_to_Float_Get.py ...