Python Forum
[Tkinter] String variables in Tkinter - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] String variables in Tkinter (/thread-19039.html)



String variables in Tkinter - rturus - Jun-11-2019

Hi,

I have string variable called park. I cannot see the value of the 'park' with following label in Tkinter:

lab=Label(mg,text=('Where: %.s'%(park))).place(x=10,y=30)
but I can see value of 'park' in the following way:

lab1_0=Label(mg,text=('Where:')).place(x=10,y=30)
lab1_1=Label(mg,text=((park))).place(x=45,y=45)
Any idea why the first one wouldn't display the 'park'?

Thanks.


RE: String variables in Tkinter - joe_momma - Jun-11-2019

make a string like:

my_variable= 'where's : s%'%(park)
lab=Label(mg,text=my_variable).place(x=10,y=30)



RE: String variables in Tkinter - rturus - Jun-12-2019

Thanks.