pythonuser-interfacetk-toolkitsimpledialog

Python tkSimpleDialog Fullscreen and Focus Over Fullscreen Parent


I am having a problem with getting tkSimpleDialog to take focus over my fullscreen window GUI. I have a GUI that I am trying to use a dialog window to use as an admin password to close the GUI (like a kiosk mode app) using root.quit(). The problems with this are that the dialog does not come in front of the parent windows if the parent windows are fullscreen. Additionally, I would like to make the tkSimpleDialog go fullscreen as well.

Here is the code for how the dialog box is being called/created using the tkSimpleDialog.py in my program:

    def check_admin_password():
    # use askstring here to verify password.
    pass_attempt = simpledialog.askstring("Verifying access","Please enter Admin password", parent=window, show="*")
    if pass_attempt == "password":
        root.quit() # used whatever your instance of Tk() is here in place of root.

admin_minimize_button = Button(window, text = "Administrator", command = check_admin_password, width=35, height=12)
admin_minimize_button.grid(row=4, column=0)

I am using the following code for the parent window and I believe there is something with the overrideredirect(True) that is affecting the focus of my dialog window:

qwindow = Toplevel(root)                                            #renames Toplevel "popup" window frame to variable "qwindow"
qwindow.title('Mission Queue')                                      #creates title on popup window
w, h = qwindow.winfo_screenwidth(), qwindow.winfo_screenheight()    #aquires dimensions from display size
qwindow.geometry("%dx%d+0+0" % (w, h))                              #sets window size to aquired dimensions
qwindow.overrideredirect(True)                                      #removes top bar and exit button from parent window frame

I have tried editing the tkSimpleDialog.py file and adding an overrideredirect(True) line however that is not working. If more information is needed, let me know. Any advice would be much appreciated. Thanks in advance.


Solution

  • Due to my inability to figure out a solution using tkSimpleDialog, I attempted a different approach creating my own "dialog". Unfortunately, I was still unable to get the dialog to have the entry line take focus with the screen window being set to wm_attributes('-fullscreen', 'True') and overrideredirect(True). While it would have been better to have both work; for my purposes, it will work fine to just be fullscreen in my application without overrideredirect(True). For anyone with a similar issue or wanting to see more documentation on my progress, heres the link to my other forum post: (Tkinter Entry Widget with Overrideredirect and Fullscreen). Thanks for the help!