1

I've been fighting with ttk style for about 2 days right now, but nothing seems to work. I've tried a lot of different approaches, but I had no effect. Right now, I just want to see that the Frame that I'm trying to add to my App is working, could you please show me where is the problem?

import tkinter as tk
from tkinter import ttk


class App(tk.Tk):
    def __init__(self):
        super().__init__()

        # Main window configuration
        self.title("Work Tracker")
        self.geometry("600x700")
        self.resizable(0,0)
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        # Styles
        style = ttk.Style()
        style.configure('TFrame', background='blue')

        # Logo frame
        frame = ttk.Frame(self, width=200, height=150)
        frame.grid_rowconfigure(0, weight=1)
        frame.grid_columnconfigure(0, weight=1)
        frame.grid_propagate(False)
        frame.grid(row=0, column=0, sticky='nw')
        
        label = ttk.Label(frame, text ="WORK TRACKER")
        label.pack()



def main():
    app = App()
    app.mainloop()

main()
Adude
  • 7
  • 6
  • `frame.grid(row=0, column=0, sticky='nw')` instructs the frame to be in column=0, row=o and to stick in the corner north west. What you probably want is to stretch that frame. You could stretch it on the x-axis with `we` or y-axis with `ns` or in both with `nswe`. You may want to read [this](https://stackoverflow.com/a/63536506/13629335). I've wrote this for beginners, but intermediate can look there as well. To be honest, I do look there first myself if I don't recall. – Thingamabobs Sep 09 '22 at 19:02
  • Oh my god, I can't believe I lost so much time because I misunderstood this option, thank you so much my dude <3 – Adude Sep 09 '22 at 19:20

0 Answers0