Personal tools
You are here: Home Forum Use YACS : how can I display a message ?

YACS : how can I display a message ?

Up to Use

YACS : how can I display a message ?

Posted by Gérald NICOLAS at September 03. 2012

At the end of the execution of a YACS scheme, I want to display a message in an window. Is there any component for that ? Or any other idea ?

Re: YACS : how can I display a message ?

Posted by Richard S. at September 03. 2012

Perhaps with a Python-Node containing a script like this:   

    import SalomePyQt
   
    sgPyQt = SalomePyQt.SalomePyQt()     
    rom PyQt4 import QtGui
    parent = sgPyQt.getDesktop()   
    self = parent   
    QtGui.QMessageBox.warning(self,
                              self.tr("Message"),
                              self.tr("YACS Shema Calculation done!"),
                              )

 

Regards,

Richard

Re: YACS : how can I display a message ?

Posted by Gérald NICOLAS at September 05. 2012
I tried your suggestion but nothing was displayed. Error ?
Another suggestion was :
-----------------
import Tkinter
root = Tkinter.Tk()
root.title('Info')
Tkinter.Message(root, text="My message").pack()
root.mainloop()
-----------------
That's correct.

Regards,
Gérald

Re: YACS : how can I display a message ?

Posted by Kloss Francis at September 05. 2012

Hello,

I confirm that this solution cannot work because your script is not is the main thread for Qt used by the desktop of SALOME.

At time, under YACS, it is not possible to run a python script under this main thread.

 

Regards,

 

Francis Kloss

 

Previously Richard S. wrote:

Perhaps with a Python-Node containing a script like this:   

    import SalomePyQt
   
    sgPyQt = SalomePyQt.SalomePyQt()     
    rom PyQt4 import QtGui
    parent = sgPyQt.getDesktop()   
    self = parent   
    QtGui.QMessageBox.warning(self,
                              self.tr("Message"),
                              self.tr("YACS Shema Calculation done!"),
                              )

 

Regards,

Richard

 

Re: YACS : how can I display a message ?

Posted by Kloss Francis at September 05. 2012

Hello,

 

See an exemple in attachement with Qt. It run under SALOME 6.5.0.

 

regards,

Francis Kloss

 

Attachments

Re: YACS : how can I display a message ?

Posted by Gérald NICOLAS at September 05. 2012

Voici une autre solution en Qt :

from PyQt4 import QtGui
import sys
app = QtGui.QApplication(sys.argv)
if Message != "" :
    QtGui.QMessageBox.warning(None, MessageBoxTitle,Message)

Je joins le fichier pour les amateurs. Merci à tous.

Attachments
Powered by Ploneboard
Document Actions