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
  why my list changes to a string as I move to another window in tkinter? pymn 4 2,546 Feb-17-2022, 07:02 AM
Last Post: pymn
  [Tkinter] How to compare two variables correctly in tkinter scratchmyhead 2 3,817 May-10-2020, 08:04 PM
Last Post: scratchmyhead
  [Tkinter] tkinter issue with variables carrying over between functions PengEng 1 1,703 Apr-06-2020, 06:13 PM
Last Post: deanhystad
  [Tkinter] Tkinter bringing variables from 1 frame to another zukochew 6 12,412 Dec-26-2019, 05:27 AM
Last Post: skm
  Problem with tkinter and string Dule 5 4,731 May-26-2019, 10:57 AM
Last Post: Yoriz
  Int Variables in different Tkinter windows only returning 0 harry76 3 4,082 May-26-2019, 10:24 AM
Last Post: Yoriz
  [Tkinter] color a string of characters in tkinter atlass218 6 9,111 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 5,605 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