If this is my code:
from tkinter import *
class Program:
def __init__(self):
self.tk = Tk()
self.tk.attributes("-topmost", 1)
self.canvas = Canvas(self.tk, height=500, width=500, highlightthickness=0)
self.canvas.pack(fill="both", expand=1)
self.width = 500
self.height = 500
self.tk.bind("<Configure>", self.resize)
self.input = Entry(self.tk)
self.input.pack(fill="x", expand=1)
self.button = Button(self.tk, text="Start!", command=self.pressed)
self.button.pack(fill="x", expand=1)
self.pressed = 0
self.start = time()
def mainloop(self):
while 1:
self.canvas.delete("all")
self.canvas.create_rectangle(0, 0, self.width, self.height, fill="#4dffff", width=0)
self.tk.update()
def pressed(self):
self.pressed = 1
def resize(self, event):
self.width = event.width
self.height = event.height
Program().mainloop()
If I run it then this window opens:
If I then move the window it looks like this:
As soon as I resize it (by fullscreen for instance) I get this window:
How would I have to change the code to consistentely have the result where the canvas (I mean the colored part of it) covers the uncovered part of the Tk() window?