Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help understand loops
#10
from tkinter import messagebox
from threading import Thread

def Loop1():
    while 1:
        messagebox.showinfo("Title", "1")
def Loop2():
    while 1:
        messagebox.showinfo("Title", "2")

process1 = Thread(target=Loop1)
process2 = Thread(target=Loop2)
process1.start()
process2.start()
I should be getting 2 messages popped but i only see one constantly.
Second message does not trigger because its stuck in a loop 1

I understand that loop 1 prevents loop 2 to start until its broken but isnt what Threading was for ?
Why i dont get two message boxes at same time ?
It seems to work with print but not with message box.
Thank you.
Reply


Messages In This Thread
Help understand loops - by tonycstech - Nov-27-2019, 04:43 AM
RE: Help understand loops - by Malt - Nov-27-2019, 05:06 AM
RE: Help understand loops - by tonycstech - Nov-27-2019, 05:33 AM
RE: Help understand loops - by snippsat - Nov-27-2019, 06:04 AM
RE: Help understand loops - by buran - Nov-27-2019, 06:16 AM
RE: Help understand loops - by tonycstech - Nov-27-2019, 07:10 AM
RE: Help understand loops - by buran - Nov-27-2019, 07:16 AM
RE: Help understand loops - by tonycstech - Nov-27-2019, 08:43 AM
RE: Help understand loops - by snippsat - Nov-27-2019, 01:32 PM
RE: Help understand loops - by tonycstech - Nov-30-2019, 06:21 AM

Forum Jump:

User Panel Messages

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