#Why dont my python GUI work?
21 messages · Page 1 of 1 (latest)
You need to position the things you are creating on the window
greeting.pack() for example
and it also shows " keyword argument repeated : text"
can you elaborate please
You need to position your labels and buttons on the window. It might be a good idea to follow a tutorial. https://realpython.com/python-gui-tkinter/
i have been using this guide, i fixed greeting.pack()
but the button is still not working
You also need to position the button
button.pack()
There are more options available if you keep following the tutorial
https://realpython.com/python-gui-tkinter/#controlling-layout-with-geometry-managers
thank you very much, this tutorial didn't mentioned button.pack() as far as i can see
pack is a general thing for widgets but maybe it could be clearer yeah. Any widget needs to be placed on the screen using one of the methods in the link above
Can we make modern looking GUIs with tkinter?
If you do from tkinter import ttk and then use ttk.Button for example then it should look a bit more "modern"
from tkinter import *
from tkinter import ttk
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
root.mainloop()
Here is an example from the docs showing what the imports should look like
https://docs.python.org/3/library/tkinter.html
Yeah that's as "modern" as you are going to get with tkinter
@woven agate Thanks