-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
50 lines (45 loc) · 1.58 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
try:
from tkinter import Tk, StringVar, IntVar
except:
from Tkinter import Tk, StringVar, IntVar
import time
import traceback
import constantes
from ventana_inicio import Inicio
class Main(Tk):
def __init__(self):
Tk.__init__(self)
self._frame = None
self.title(constantes.titulo)
self.resizable(False, False)
self.iconbitmap(constantes.icon)
self.ancho_pantalla = self.winfo_screenwidth()
self.alto_pantalla = self.winfo_screenheight()
self.geometry(
f'{str(constantes.WINDOW_WIDTH)}x{str(constantes.WINDOW_HEIGHT)}+{str(int(self.ancho_pantalla-0.75*self.ancho_pantalla))}+0')
self.config(bg='black',
bd='20',
relief='groove',
cursor='tcross')
self.call("tk", "scaling", 1)
self.overrideredirect(False) # deshace el marco
self.rowconfigure((0, 1), weight=0)
self.columnconfigure((0, 1), weight=0)
self.puntaje = IntVar()
self.nombre = StringVar()
self.dificultad = StringVar()
self.velocidad = IntVar()
self.tiempo = time.time()
def cambia_frame(self, frame_a_cambiar, master):
nuevo_frame = frame_a_cambiar(master)
if self._frame is not None: # si no es la primera vez que inicia el programa
self._frame.grid_remove()
self._frame = nuevo_frame
self._frame.grid(row=0, column=0)
try:
if __name__ == "__main__":
root = Main()
root.cambia_frame(Inicio, root)
root.mainloop()
except:
traceback.print_exc()