This is my first time ever asking a question here, I've done my best to avoid it as much as I could up until this point, but I have reached a wall where I feel that I have explored all avenues for google searching and reading.
I am using tkinter library in python. My goal is to have a window instantiate and refresh with new text every second. The issue with my code is that the text (probably by default?) is extremely small. I want the text to fit the window at all times. Additionally, I want the text size to grow or shrink (still fitting) when the window is adjusted by the user. This is my current tkinter code:
import tkinter as tk
try:
import tkFont
except:
from tkinter import font as tkFont
class display(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.font = tkFont.Font(size = 10)
self.label = tk.Label(self, width=10, height=10)
self.label.pack()
self.update()
def update(self):
self.label.configure(font = self.font, text="I want some font right here")
self.font = tkFont.Font(size = (-1 * round(self.winfo_height() - 100)))
self.after(1000, self.update)
if __name__ == '__main__':
root = display()
root.mainloop()
I am probably already doing some funky things. Any help is greatly appreciated. I will respond to any follow-up questions anyone may have.