Python Forum
QUIZ GUI Form_When admin panel is open, main quiz form is getting freeze
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUIZ GUI Form_When admin panel is open, main quiz form is getting freeze
#1
Hi Expert,

I have already created one QUIZ GUI application where user can select option and click on submit button to check the score. One ADMIN button is also placed to open the ADMIN PANEL, but when the admin panel is open, both the main quiz form and admin panel is getting freezed.

I have already attached the .py file, please see it and suggest.

Regards,
Uday

Attached Files

.py   import tkinter as tk.py (Size: 8.95 KB / Downloads: 104)
Reply
#2
Only 1 mainloop
Reply
#3
(Aug-25-2023, 01:02 PM)deanhystad Wrote: Only 1 mainloop

(Aug-25-2023, 01:02 PM)deanhystad Wrote: Only 1 mainloop
I have removed it, still it is getting freezed, if the admin panel is open. I have tested in my system. I have attached the latest file.
Larz60+ write Aug-25-2023, 01:31 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Attached Files

.py   import tkinter as tk.py (Size: 8.89 KB / Downloads: 57)
Reply
#4
Don't attach, post your your code using the python button (insert python).
Reply
#5
Not letting the top window lose focus is what causes the problem. Why are you doing that?

This is as short an example I can come up with that demonstrates the problem.
import tkinter as tk
from tkinter import simpledialog


class TopmostForm:
    def __init__(self, root):
        self.root = root
        self.admin_button = tk.Button(self.root, text="Admin", command=self.admin_access)
        self.admin_button.pack()
        self.root.bind("<FocusOut>", self.on_focus_out)
        
    def on_focus_out(self, event):
        """comment out following line and problem goes away"""
        self.root.focus_force()

    def admin_access(self):
        simpledialog.askstring("Admin Access", "Enter admin password:")
            

if __name__ == "__main__":
    root = tk.Tk()
    app = TopmostForm(root)
    root.mainloop()
I would get rid of the code that tries to keep focus on the top window. It is causing a problem, and it doesn't keep focus on the top window anyway.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to edited Tkinter Toplevel from main form? kucingkembar 7 246 Apr-25-2024, 10:16 AM
Last Post: deanhystad
  Tkinter + Multiprocessing startmap makes UI Freeze sunny9495 4 1,407 Nov-13-2022, 12:49 PM
Last Post: sunny9495
  Noob here. Random quiz program. Using a while loop function and alot of conditionals. monkeydesu 6 1,409 Sep-07-2022, 02:01 AM
Last Post: kaega2
  [split] Could you please clarify where i did mistake also how run without admin right Abubakkar 1 1,797 Jun-14-2021, 09:32 AM
Last Post: Larz60+
  Quiz help jslack17 5 2,390 May-04-2021, 02:57 PM
Last Post: perfringo
  mpv window freeze before video end rfeyer 18 7,116 Mar-09-2021, 06:12 PM
Last Post: rfeyer
  Does anyone have unicurses panel functions working on a Windows 10 platform? pjfarley3 0 1,473 Oct-11-2020, 04:41 AM
Last Post: pjfarley3
  Stuck on python quiz challenge baesian 2 2,188 Aug-16-2020, 12:52 AM
Last Post: scidam
  Install Python 3.8 for EduPython and Cx-Freeze mederic39 1 1,799 Jul-24-2020, 01:24 PM
Last Post: Larz60+
  Why aren't all curses panel functions supported in python curses.panel? pjfarley3 2 2,676 Jul-22-2020, 11:08 PM
Last Post: pjfarley3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020