How to do it...

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:

  1. Create a new Python module and name it
  2. At the top of the module, import tkinter:
import tkinter as tk
  1. Create an instance of the tkinter class:
win = tk.Tk()
  1. 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))
  1. The following screenshot shows the final ...

Get Python GUI Programming Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.