Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
non-blocking pop up
#1
is there a way to create a non-blocking pop up inside an app, to instruct a user abaut what to do next?
#2
Hi Vincent,

Yes this is possible. I recommend you to use Python's tkinter to do so. The code below shows 3 useful ways to implement popups. This will block the code in your app, not RoboDK. If you need to run code while your user interface is blocked you can run it on a separate thread.

Albert

Code:
if sys.version_info[0] < 3: # Python 2.X only:
   import Tkinter as tk
   import tkMessageBox as messagebox
else: # Python 3.x only
   import tkinter as tk
   from tkinter import messagebox
   
def ShowMessage(msg, title=None):
   print(msg)
   if title is None:
       title = msg
       
   root = tk.Tk()
   root.overrideredirect(1)
   root.withdraw()
   root.attributes("-topmost", True)        
   result = messagebox.showinfo(title, msg) #, icon='warning')#, parent=texto)
   root.destroy()
   return result

def ShowMessageYesNo(msg, title=None):
   print(msg)
   if title is None:
       title = msg
       
   root = tk.Tk()
   root.overrideredirect(1)
   root.withdraw()
   root.attributes("-topmost", True)        
   result = messagebox.askyesno(title, msg) #, icon='warning')#, parent=texto)
   root.destroy()
   return result

def ShowMessageYesNoCancel(msg, title=None):
   print(msg)
   if title is None:
       title = msg
       
   root = tk.Tk()
   root.overrideredirect(1)
   root.withdraw()
   root.attributes("-topmost", True)        
   result = messagebox.askyesnocancel(title, msg)#, icon='warning')#, parent=texto)
   root.destroy()
   return result
  




Users browsing this thread:
1 Guest(s)