Al redirigir al usuario a la funcion de otro archivo .py me da limite de 3 veces y luego se cierra
Algo asi
Programa > 2do Programa > Vuelvo al programa > 2do programa > Programa >2do Programa > Programa > 2do programa en lugar de ejecutar cierra
los archivos tienen una funcion la cual se llaman entre ellos para ejecutarlos algo asi:
def informacion():
info=Tk()
#Mas codigo
Pero el problema es que al redirigir 3 veces el programa en lugar de redirigir de nuevo se cierra, y esto seria muy molesto para el usuario tener que cerrar la app , abrirla
Encima, es un sistema operativo por lo que por este pequeño error, el usuario tendria que tener la computadora especificamente al lado para apretar el boton de prendido porque,ahora se cierra porque lo ejecuto, pero cuando sea sistema no se cerraría, se apagaría y bueno, imaginense la molestia
O si no aun mas molesto, configurar de nuevo el boot, seria molesto no solo porque es molesto bootear de nuevo, si no porque tambien hay gente que no sabe y tiene miedo de modificar y arruinar su computadora
Archivo principal ( main.py )
from tkinter import ttk
import mouse
import time
import webbrowser
from tkinter import *
def Motion(event):
global x_mouse
global y_mouse
x_mouse=event.x
y_mouse=event.y
def right_both(event):
destroyright("che")
right_click("che")
None
def destroyright(event):
rightclick.destroy()
info_sys.destroy()
arrow.destroy()
background.bind("<Button-3>",right_click)
def right_click(event):
global rightclick
global info_sys
global arrow
rightclick=Frame(root,bg="white",width=300,height=350)
rightclick.place(x=x_mouse+1,y=y_mouse+1)
background.unbind("<Button-3>")
background.bind("<Button-1>",destroyright)
background.bind("<Button-3>",right_both)
info_sys=Label(root,text="Informacion del sistema",bg="white")
info_sys.place(x=x_mouse+20,y=y_mouse+10)
arrow=Label(root,text="►",bg="white")
arrow.place(x=x_mouse+280,y=y_mouse+10)
info_sys.bind("<Button-1>",info)
def _comments():
webbrowser.open("mailto:foxy77843@gmail.com?Subject=Comentario%20De%20SaDro%20System&body=Mi%20Comentario%20De%20SaDro%20System%20Es ")
None
def _restart():
root.destroy()
time.sleep(0.1)
main()
def _shutdown():
exit()
def menu_task2(event):
_task.destroy()
task_sadro_1.bind("<Button-1>",menu_task)
shutdown.destroy()
refresh.destroy()
def menu_task3(event):
_task.destroy()
task_sadro_1.bind("<Button-1>",menu_task)
shutdown.destroy()
refresh.destroy()
right_click("Hola")
def menu_task(event):
global _task
global shutdown
global refresh
_task=Frame(root,bg="#313131",width=600,height=500)
_task.place(x=230,y=root.winfo_screenheight()-555)
background.bind("<Button-1>",menu_task2)
background.bind("<Button-2>",menu_task2)
background.bind("<Button-3>",menu_task3)
task_sadro_1.bind("<Button-1>",menu_task)
shutdown=Button(root,text="Apagar",bg="#313131",command=_shutdown)
shutdown.place(x=230,y=root.winfo_screenheight()-81)
refresh=Button(root,text="Reiniciar",bg="#313131",command=_restart)
refresh.place(x=280,y=root.winfo_screenheight()-81)
def restart():
root.destroy()
def info(event):
root.destroy()
import system_info
system_info._info()
_TclVersion=TclVersion
_TkVersion=TkVersion
def main():
global root
global background
global task_sadro_1
root=Tk()
root.title("SaDro - Sistema")
root.attributes("-fullscreen",True)
background=Frame(root,bg="pink",width=9999,height=9999)
background.place(x=0,y=0)
taskbar=Frame(root,bg="violet",width=9999,height=50)
taskbar.place(x=0,y=root.winfo_screenheight()-50)
task_sadro=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/taskbar/sadro_s.sadroimage")
task_sadro_1=Label(root,image=task_sadro,bg="violet")
task_sadro_1.place(x=root.winfo_screenwidth()/2-200,y=root.winfo_screenheight()-47)
task_sadro_1.bind("<Button-1>",menu_task)
task_sadro_1.bind("<Button-1>",menu_task)
task_sadro_help=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/taskbar/help_icon.sadroimage")
task_sadro_help_1=Label(root,image=task_sadro_help,bg="violet")
task_sadro_help_1.place(x=root.winfo_screenwidth()/2-200+50,y=root.winfo_screenheight()-43)
desktop_sys_info=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/sys_info/64.sadroimage")
desktop_sys_info_1=Label(root,image=desktop_sys_info,bg="pink")
desktop_sys_info_1.place(x=10,y=10)
desktop_sys_info_1.bind("<Button-1>",info)
desktop_sys_info_2=Label(root,text="Información del \n sistema",bg="pink")
desktop_sys_info_2.place(x=0,y=84)
background.bind("<Button-3>",right_click)
background.bind("<Motion>",Motion)
root.mainloop()
main()
Archivo de info de sistema (2do programa)
def _main(event):
info.destroy()
import destroyroot
exec("destroyroot")
from tkinter import *
import platform
from typing import TYPE_CHECKING
syst=platform.system()
def _info():
global info
info=Tk()
info.attributes("-fullscreen",True)
systemVersion="Pre-Alpha 0.1"
infoFrame=Frame(info,bg="orange",width=9999999,height=9999999)
infoFrame.place(x=0,y=0)
TclLabel=Label(info,text=f"Tcl/Tk Version: {TclVersion}")
TclLabel.place(x=50,y=50)
TkIconPhoto=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/tk.sadroimage")
TkIcon=Label(info,image=TkIconPhoto,bg="orange")
TkIcon.place(x=160,y=45)
SystemLabel=Label(info,text=f"SaDro Version: {systemVersion}")
SystemLabel.place(x=50,y=100)
SystemIconPhoto=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/sadro/sadro64.sadroimage")
SystemIcon=Label(info,image=SystemIconPhoto,bg="orange")
SystemIcon.place(x=230,y=76)
operatingSystem=Label(info,text=f"Sistema operativo : {syst}")
operatingSystem.place(x=50,y=150)
taskbar=Frame(info,bg="violet",width=9999,height=50)
taskbar.place(x=0,y=info.winfo_screenheight()-50)
close=Frame(info,bg="skyblue",width=9999,height=30)
close.place(x=0,y=0)
closeFrame=Frame(info,bg="white",width=50,height=30)
closeFrame.place(x=info.winfo_screenwidth()-50,y=0)
closeLabel=Label(info,text="×",font=("Calibri",16),bg="white",fg="black")
closeLabel.place(x=info.winfo_screenwidth()-32.5,y=-3)
closeLabel.bind("<Button-1>",_main)
closeFrame.bind("<Button-1>",_main)
closeLabel2=Label(info,text="Informacion de SaDro System™",bg="skyblue").pack()
task_sadro=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/taskbar/sadro_s.sadroimage")
task_sadro_1=Label(info,image=task_sadro,bg="violet")
task_sadro_1.place(x=15,y=info.winfo_screenheight()-47)
task_sadro_help=PhotoImage(file="C:/ProgramData/sysadro/bin/icons/taskbar/help_icon.sadroimage")
task_sadro_help_1=Label(info,image=task_sadro_help,bg="violet")
task_sadro_help_1.place(x=60,y=info.winfo_screenheight()-43.5)
info.mainloop()