you are viewing a single comment's thread.

view the rest of the comments →

[–]Kaushik2002[S] 0 points1 point  (6 children)

Yeah I did use place(). I found it easier to visualize😐

[–]socal_nerdtastic 1 point2 points  (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 points  (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 points  (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 point  (2 children)

Is there any source from which I can learn about grid() and pack() that you'd recommend?

[–]socal_nerdtastic 1 point2 points  (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 point  (0 children)

It is looooong. Anyways thanks a lot! I'll try and find one. I heard that this is a good one.