Python Forum
[Tkinter] Please help, my Label does not show up on my gui ? - 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] Please help, my Label does not show up on my gui ? (/thread-19078.html)



Please help, my Label does not show up on my gui ? - robertinoc - Jun-12-2019

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


RE: Label su Tkinter - Yoriz - Jun-12-2019

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. 



RE: Please help, my Label does not show up on my gui ? - robertinoc - Jun-12-2019

Thank you! The code works now.

Robertino.