winfo_exists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dada

    #1

    winfo_exists

    I want to know, whether a window is already open or not. Following a
    peace of the code.
    -----
    ....
    class Auswahlmenue:
    def __init__(AM):

    AM.Fenster = Toplevel()
    ...
    AM.Fenster.dest roy(); Startsortierung ()
    #-------------------------
    class Startsortierung :
    def __init__(SS):
    #-------------------------
    def Abbruch(xxx):
    SS.Fenster_2.de stroy()
    #!! Abfragen, ob bereits ein Auswahlmenü geöffnet ist!
    if not Auswahlmenue.Fe nster.winfo_exi sts():
    Auswahlmenue()
    #-------------------------
    def Auswahl(xxx):
    Auswahlmenue()
    #-------------------------
    def weiter(xxx):
    SS.Fenster_2.de stroy()
    #-------------------------
    SS.Fenster_2 = Toplevel()
    Label(SS.Fenste r_2, text= u'... ...').pack()
    SF = Button(SS.Fenst er_2, text= u'abbrechen', underline= 0)
    SF.pack(side= u'left')
    SS.Fenster_2.bi nd(sequence= '<KeyPress-a>', func= Abbruch)
    SF = Button(SS.Fenst er_2, text= u'Auswahlmenü', underline= 0)
    SF.pack(side= u'left')
    SS.Fenster_2.bi nd(sequence= '<KeyPress-A>', func= Auswahl)
    SF = Button(SS.Fenst er_2, text= u'weiter', underline= 0)
    SF.pack(side= u'right')
    SS.Fenster_2.bi nd(sequence= '<KeyPress-w>', func= weiter)
    TkFenster.wait_ window(SS.Fenst er_2)
    ----
    The main programm calls the class Auswahlmenue. In this class the user
    can choose Startsortierung . In this class the user may (after a
    prozess) go back to Auswahlmenue without destroying the
    Startsortierung-window (SS.Fenster_2), because he needs the information
    shown there. Or he may go back immeaditely to Auswahlmenue via Abbruch
    (destroying SS.Fenster_2 and opening AM.Fenster). In the first way the
    user later will close the SS.Fenster_2-window - but how do I get the
    information, the AM.Fenster is already open or not? I do not want have
    two AM.Fenster open.
    I hoped toget this via winfo_exists, but there´s a mistake in the
    if-row.
    Indeed I could do it with a global flag, but is there a possibility to
    do it with winfo_exists()?

    Thanks for help
    Dada

Working...