0

I am trying to make a fullscreen window with tkinter but the window covers the whole screen including the windows taskbar.How do i make the window fit nicely into the screen without covering the taskbar? Here is my source code:

from tkinter import*
my_window = Tk()

my_window.title("Demo")

screen_width = my_window.winfo_screenwidth()
screen_height = my_window.winfo_screenheight()

x = (screen_width /2) - (width_of_window/2)
y = (screen_height/2) -(height_of_window/2)

my_window.geometry("%dx%d+0+0"%
(my_window.winfo_screenwidth(),my_window.winfo_screenheight())

my_window.mainloop()

I am coding in windows 10 using vs code.

j_4321
  • 15,431
  • 3
  • 34
  • 61
kelvinmacharia254
  • 117
  • 1
  • 3
  • 12

1 Answers1

1

This seems to be a difficult task. The easiest way I have found is to:

my_window.wm_state('zoomed')

This corresponds to maximized, but not fullscreen. This does not seem to work on all platforms.

Also see tkinter python maximize window

figbeam
  • 7,001
  • 2
  • 12
  • 18