I am currently trying to add a feature to my program where the programs resolution will change at every launched based on your screen resolution. I have run into an issue though.
It first states that my variables, width and height are undefined. I then modified my code and it then says bad geometry specifier.
Undefined Variables:
pygame.mixer.init()
app = minecraftGuideApp()
#Window Definitions
screen_width = app.winfo_screenwidth()
screen_height = app.winfo_screenheight()
if screen_width == "1366" and screen_height == "768":
width = "1280"
height = "720"
app.geometry(width, height)
app.mainloop()
Bad Geometry Specifier:
pygame.mixer.init()
app = minecraftGuideApp()
#Window Definitions
screen_width = app.winfo_screenwidth()
screen_height = app.winfo_screenheight()
width = screen_width
height = screen_height
app.geometry((width, height))
app.mainloop()
I am still learning Python, so please excuse any dumb mistakes I am making.
What am I doing wrong though?
The syntax for a call to the Tkinter geometry method is given at this reference. You need to compose a geometry string in the proper syntax
which is:
"%dx%d%+d%+d" % (width, height, xoffset, yoffset)
In your case the call should look like
app.geometry("1280x720")