Tkinter padx problem

Tkinter padx problem

brad.bylls
Collaborator Collaborator
2,980 Views
4 Replies
Message 1 of 5

Tkinter padx problem

brad.bylls
Collaborator
Collaborator
I am building a Python tkinter GUI
The code below works just fine.
ttk.Label(win, text='Select a screw size from the list:',
                        anchor = 'e',
                        background = bgColor,
                        font = 16,
                        width = 25).grid(column=0row=0)
But if I add the padx option,
ttk.Label(win, text='Select a screw size from the list:',
                        anchor = 'e',
                        background = bgColor,
                        padx = 5,
                        font = 16,
                        width = 25).grid(column=0row=0)
I get an error:
Exception has occurred: TclError
unknown option "-padx"
Everything I find online says this should work.
Any ideas please?
Thank you.
Brad Bylls
0 Likes
Accepted solutions (1)
2,981 Views
4 Replies
Replies (4)
Message 2 of 5

thomasa88
Advocate
Advocate
Accepted solution

Did not find a Python resource, but some Googling turned up info on ttk.Label and tkinter.Label having different options. So, maybe "padding"?

 

Compare these:

https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_label.htm

https://www.tcl.tk/man/tcl8.6/TkCmd/label.htm

 

0 Likes
Message 3 of 5

BrianEkins
Mentor
Mentor

Are you using Windows or Mac?  There are known issues with Tkinter on Mac, (https://www.python.org/download/mac/tcltk/).  Because of that not much effort has gone into testing Tkinter with Fusion.  I know in the early days of the API, I wrote some test apps thinking Tkinter would be a good GUI solution.  I wrote them on Windows but then they didn't work on Mac and eventually abandoned the idea of using Tkinter as a general GUI solution.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 4 of 5

brad.bylls
Collaborator
Collaborator
You said in the early days you tried tkinter.
Have you tried it recently?
It seems so easy to work with compared to the API
And there is no good documentation and examples to help build a GUI in the
API.

Brad
Brad Bylls
0 Likes
Message 5 of 5

brad.bylls
Collaborator
Collaborator
padding works!
Thank you for the input.
Brad Bylls
0 Likes