Python Forum
[Tkinter] String variables in Tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] String variables in Tkinter
#1
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.
Reply
#2
make a string like:

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] How to compare two variables correctly in tkinter scratchmyhead 2 1,531 May-10-2020, 08:04 PM
Last Post: scratchmyhead
  [Tkinter] tkinter issue with variables carrying over between functions PengEng 1 858 Apr-06-2020, 06:13 PM
Last Post: deanhystad
  [Tkinter] Tkinter bringing variables from 1 frame to another zukochew 6 7,441 Dec-26-2019, 05:27 AM
Last Post: skm
  Problem with tkinter and string Dule 5 2,659 May-26-2019, 10:57 AM
Last Post: Yoriz
  Int Variables in different Tkinter windows only returning 0 harry76 3 2,522 May-26-2019, 10:24 AM
Last Post: Yoriz
  [Tkinter] color a string of characters in tkinter atlass218 6 5,708 Mar-28-2019, 03:17 PM
Last Post: atlass218
  [Tkinter] THow to search a string in a file and display it in listbox by Tkinter mosavit 2 4,082 Jun-21-2017, 08:02 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020