Tkinter : Garder la console en arrière plan
Bonjour à tous,
J'ai créé un programme dans lequel j'utilise une fenêtre principale faisant office d'interface, et d'autres fenêtres additionnelles apparaissant et s'autodétruisant.
Mais dès qu'une fenêtre additionnelle se ferme, la console repasse automatiquement devant ma fenêtre principale ... c'est horripilant :(
J'ai créé un script pour palier à ce problème, mais pour l'instant je ne résous rien.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
from tkinter import*
def F1():
global fen
fen=Tk()
fen.wm_title("Première fenêtre")
lrg,htr=fen.winfo_reqwidth(),fen.winfo_reqheight()
el,eh=fen.winfo_screenwidth(),fen.winfo_screenheight()
fen.geometry("%dx%d+%d+%d"%(4*lrg,2*htr,(el-4*lrg)/2,(eh-2*htr)/2))
F2()
fen.mainloop()
def F2():
fen2=Tk()
fen2.title("Seconde fenêtre")
fen2.wm_attributes('-topmost',1)
lrg,htr=fen2.winfo_reqwidth(),fen2.winfo_reqheight()
el,eh=fen2.winfo_screenwidth(),fen2.winfo_screenheight()
fen2.geometry("%dx%d+%d+%d"%(2*lrg,htr,(el-2*lrg)/2,(eh-htr)/2))
fen2.after(2000,fen2.destroy)
fen2.mainloop()
F1() |
J'ai essayé avec Toplevel() qui ne donne rien non plus.
Merci de m'avoir lu.