Python UI question

Discussion in 'Mac Programming' started by lynkynpark86, Dec 21, 2011.

  1. macrumors 6502

    #1
    Is there a way to show a dialog box in Python without Tk, wx-python, etc? Is there something similar to AppleScript's "display dialog" I could use?
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    Run the 'osascript' command from Python.

    Example shell command line:
    Code:
    osascript -e 'tell app "System Events" to display dialog "Explode the penguin now?"'
    
    I assume you know how to open the man page for osascript, how to run subprocesses in Python, etc.
     
  3. thread starter macrumors 6502

    #3
    Thanks, I just tried:
    Code:
    osascript -e 'display dialog "Hello world"'
    
    It works now with system events, thanks!
     

Share This Page