from tkinter import * v=Tk() v.geometry("400x400") a= IntVar() a.set(5.494949) l=Label(textvariable= a) l.pack()
I use this and return the label with 5.494949 and I need 5.49
It might just help :)
from tkinter import * v=Tk() v.geometry("400x400") a= IntVar() # round function simply rounds the var upto given number of decimal places in the function argument a.set(round(5.494949,2)) l=Label(textvariable= a) l.pack()
There is no explicit support for what you want. However, you can use StringVaror simply set the value of the label:
StringVar
l = Label(text="%.2f" % 5.494949) ... l.configure(text="%.2f" % 3.14159)