Python Forum
[Tkinter] Please help, my Label does not show up on my gui ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Please help, my Label does not show up on my gui ?
#1
Hi!
I am a total beginner in Tkinter!
I wrote this simple code:
import tkinter as tk 
from tkinter import ttk 
win = tk.Tk() # Create a win object. 

win.title("Python GUI") 
#win.resizable(False, False) # Disable resizing the window. 
ttk.Label(win, text = 'A Label') 
win.mainloop() # Start GUI. 

When I run the program, the label does not display in the window.
Why? What I did wrong?


Thank you very much at all!

Bye!
Robertino

Italy

Why does the label it no

Grazie a tutti

Robertino


Pagina: 1
Reply
#2
It doesn't know where to place the label, if you call pack it will show up
import tkinter as tk 
from tkinter import ttk 
win = tk.Tk() # Create a win object. 
 
win.title("Python GUI") 
#win.resizable(False, False) # Disable resizing the window. 
label = ttk.Label(win, text = 'A Label') 
label.pack()
win.mainloop() # Start GUI. 
Reply
#3
Thank you! The code works now.

Robertino.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Load image and show in label ko_fal 8 3,042 Oct-25-2022, 09:20 AM
Last Post: ko_fal

Forum Jump:

User Panel Messages

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