In tk: How do I inactivate a frame by opening another frame in front of it?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ogglaton
    New Member
    • Feb 2008
    • 2

    In tk: How do I inactivate a frame by opening another frame in front of it?

    Hi!!

    I'm buildning a minesweeper and when the game is won, i want to inactivate the game board and have a pop-up saying "you won". I've heard that it's possible to inactivate a frame by opening another on top. How do i do this and what kind of frame should i use? (thankful for whole code on how to create a pop-up like this).

    thank you!
  • dazzler
    New Member
    • Nov 2007
    • 75

    #2
    I hope this could help you, so the answer is using Toplevel windows, and if you already have Toplevel window use the -topmost option

    [code=python]
    def winning_popup() :

    def close_winning_p opup():
    winning_popup.d estroy()

    winning_popup = Toplevel(width= 300, height=125, bg="#4C5844")
    winning_popup.r esizable(width= False, height=False)
    winning_popup.t itle("You Won")
    winning_popup.w m_attributes("-topmost",1) #Use this if you already have Toplevel windows and want to put this over it

    winning_popup_b utton = Button(winning_ popup, text="Close", cursor="hand2", bg="#A9A9A9", command=close_w inning_popup)
    winning_popup_b utton.place(rel x=1, rely=1, x=-5, y=-5, anchor=SE, relwidth=0.25)
    [/code]

    Comment

    Working...