I'm working on a project and need to get the dimensions of my screen (I'm working on windows). I'm only amateur on python and work with it for fun and university works.
Here is my first code with arbitrary dimensions :
from tkinter import *
import random as rd
import numpy as np
import time
class game :
def __init__(self):
self.screen = Tk()
#screen size
self.screen.geometry("900x500")
#the rest is not essential to understand my problem
self.screen.mainloop()
game()
I fristly tried something I saw on youtube but a module was missing so I searched here on stackoverflow and wrote that:
#begin : creation of an str of window dim
#step 0 creation of "window"
self.window = Gtk.Window()
#step 1 obtention screen dim
self.dim = window.get_screen()
#step 2 obtention of height and length
self.h = self.dim.height
self.l = self.dim.length
#step 3 str
self.strdim = str(l) + "x" + str(h)
#end
The self.window = Gtk.Window()
part is unknowed to me because I really don't know what Gtk
stands for (I guessed it was an alias) and when I search for it I only find about a feature in C language but no module on python.
Thank y'all for your responses and help.