How to display an error message to the user ?
  • User avatar
    aalex
    junior Member
    Posts: 6
    Joined: Wed Jul 16, 2008 4:50 pm
    Location: Montréal, Québec, Canada
    Contact:

    How to display an error message to the user ?

    by aalex » Mon Dec 22, 2008 8:41 pm

    Hi all,
    How can I display an error message to the user from Python ?
    I think the proper way to do it would be to write something in red in the top right corner of the main panel.

    I haven't found any information on how to do this so far.
    Thanks,
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    by sigmasix » Wed Dec 24, 2008 11:11 am

    I think in the way you want this is impossible... Currently you can print messages to the Script output (menu Modules > Script > Script Output) using the function print("Hello")

    An other solution would be to add a text caption on your module and change the message in the code using

    Code: Select all

    module.setAttribute ('captionName','CAPTION', 'message')
  • User avatar
    zoophar
    activ8 member
    Posts: 81
    Joined: Sat Oct 20, 2007 1:33 pm
    Location: geneva / Berlin
    Contact:

    by zoophar » Mon Dec 29, 2008 1:18 am

    python allows to use OSA (Open scricting architecture)
    it's also called apple-scritps...

    see something like the module aetools aepack etc...

    import aetools
    print aetools.__doc__
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    by sigmasix » Mon Dec 29, 2008 10:19 am

    ahyeah, thanks for the tip!
  • User avatar
    zoophar
    activ8 member
    Posts: 81
    Joined: Sat Oct 20, 2007 1:33 pm
    Location: geneva / Berlin
    Contact:

    by zoophar » Tue Dec 30, 2008 11:41 pm

    we can use it but it's deprecated
    sorry :(

    http://docs.python.org/library/mac.html ... e%20events
  • User avatar
    zoophar
    activ8 member
    Posts: 81
    Joined: Sat Oct 20, 2007 1:33 pm
    Location: geneva / Berlin
    Contact:

    by zoophar » Wed Dec 31, 2008 2:36 pm

    So i've been looking forward to display en error merrage
    without adding any libs or modules to python.

    i made some cow fu fighting and some googling on the web...

    i've found
    http://www.doughellmann.com/PyMOTW/Easy ... index.html
    wich seem to be very simple... and user friendly

    Code: Select all

    import EasyDialogs
    print EasyDialog.__doc__

    prints the doc about it and all the dialog box we can use...

    So, i've tested in the terminal with the first example on the page

    Code: Select all

    import EasyDialogs
    EasyDialogs.Message('This is a Message dialog')


    the appliction launcher started and it displayed the message 'this is a Message dialog' with an OK button...

    then, i started M8 and copy pasted the code in a new module and started the module.

    M8 freezed...
    does anyone know a bit more about this?

    Cheerz and happy new year!!!!!
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    by sigmasix » Wed Dec 31, 2008 2:47 pm

    Hi, thanks for the tip!
    I tried on the terminal, I discovered the python rocket, it's fun, too bad the massage doesn't come up in front...

    I also tried in modul8, and like you I had the doom beachball... But also had the message... But no way to click ok... We'll see what we can do about it, either this working, or a 100% modul8 solution

Who is online

Users browsing this forum: No registered users and 27 guests