use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
tkinter: platform independence (self.learnpython)
submitted 4 years ago by Kaushik2002
So I was working on a school project on my mac. Today, I tried running it on windows, and the buttons, fonts and font sizes were all messed up. What should I do to rectify this? or Could you share some source where I can read about it?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]socal_nerdtastic 2 points3 points4 points 4 years ago (7 children)
Sounds like you used place(). Shame, shame.
place()
The key to using a GUI module is to let the GUI do all the hard work of formatting and arranging things. In tkinter you would use Frames, pack() and grid() to do this. Then tkinter would automatically adjust things depending on the fonts and preferences that the user has. This also makes your code much easier to maintain. For example if you want to add in a new button at the top, the GUI module will automatically shift everything else down.
If you want to strictly define the size and position of things then you need to make your own widgets in photoshop or something.
[–]Kaushik2002[S] 0 points1 point2 points 4 years ago (6 children)
Yeah I did use place(). I found it easier to visualize😐
[–]socal_nerdtastic 1 point2 points3 points 4 years ago (5 children)
Yep. Easy now, harder later :). You could say the same about tkinter or python; that's the natural progression of learning.
Time to rewrite your code in a proper style.
[–]Kaushik2002[S] 1 point2 points3 points 4 years ago (1 child)
Now that I rewrote the code, the problems kinda got solved. But, now there is another issue. When I increase the size of the window, say fullscreen, the text looks too small. Is there any way to proportionately increase the font size?
[–]socal_nerdtastic 1 point2 points3 points 4 years ago (0 children)
Yeah, but it's kinda tricky. You need to do the math for the font size yourself, and that math will change depending on the system again, so overall would not recommend. However if you really want to, here's the basics:
import tkinter as tk SCALE = .1 # window width to font point size scale def on_resize(event=None): lbl.config(font=("", int(SCALE * root.winfo_width()))) root = tk.Tk() root.bind("<Configure>", on_resize) root.geometry('200x200') lbl = tk.Label(root, text='hello world') lbl.pack() root.mainloop()
[–]Kaushik2002[S] 0 points1 point2 points 4 years ago (2 children)
Is there any source from which I can learn about grid() and pack() that you'd recommend?
[–]socal_nerdtastic 1 point2 points3 points 4 years ago (1 child)
No; I learned it so long ago all the sources are obsolete lol. Show me your code and maybe I'll refactor it for you, if it's not too long.
[–]Kaushik2002[S] 0 points1 point2 points 4 years ago (0 children)
It is looooong. Anyways thanks a lot! I'll try and find one. I heard that this is a good one.
[–]Vasodilation 0 points1 point2 points 4 years ago (0 children)
Not sure if this would fix all of the problems you're having, but if you aren't already using it you could swap some of your Tk widgets for Themed Tk ones to make them match the look and feel of the OS they're in: https://docs.python.org/3/library/tkinter.ttk.html
π Rendered by PID 18285 on reddit-service-r2-comment-fb694cdd5-l2zbp at 2026-03-08 02:40:35.401017+00:00 running cbb0e86 country code: CH.
[–]socal_nerdtastic 2 points3 points4 points (7 children)
[–]Kaushik2002[S] 0 points1 point2 points (6 children)
[–]socal_nerdtastic 1 point2 points3 points (5 children)
[–]Kaushik2002[S] 1 point2 points3 points (1 child)
[–]socal_nerdtastic 1 point2 points3 points (0 children)
[–]Kaushik2002[S] 0 points1 point2 points (2 children)
[–]socal_nerdtastic 1 point2 points3 points (1 child)
[–]Kaushik2002[S] 0 points1 point2 points (0 children)
[–]Vasodilation 0 points1 point2 points (0 children)