[Sidefx-houdini-list] Question about hou.ui.displayMessage()

Alvaro Castaneda varomix at gmail.com
Fri Feb 14 16:04:35 EST 2014


I would do it like this
result = hou.ui.displayMessage("Options", buttons=('Cancel', 'Option 1',
'Option 2'))

result would be 0 for cancel, 1 for option 1, 2 for option 2
so I can just check the result variable and do what I need

in my cause using this I can't close the dialog or escape it so you have to
choose

hope that helps


On Fri, Feb 14, 2014 at 1:54 PM, Alvaro Castaneda <varomix at gmail.com> wrote:

> Then just add a third button to cancel is a good practice anyway and just
> make sure that returns zero any other option would be either 1 or 2
> And that makes sure you catch that in code
> On Feb 14, 2014 1:35 PM, "Dominik Kirouac" <dk at shedmtl.com> wrote:
>
>> thanks Alvaro for the help, I'm still in my first week with python and
>> scripting.
>>
>> I want to give 2 options to the user, create a 'RnD scene' or create a
>> 'Shot scene', but if the user click escape or close the dialog box I want
>> to stop the script.
>>
>> So I was expecting the close_choice=None to give me a value or 'None' so
>> I could write the condition for this choice.
>>
>> Also regarding that aspect, is there any other way than hou.ui.xxx to
>> create dialog box to give choices to the user ? If I want to create a multi
>> choice dialog box is it possible ? Like a 2 x dropdown menu + a line to
>> enter text.
>>
>> Thanks
>>
>>
>>
>>
>>
>> Le 14/02/2014 2:41 PM, Alvaro Castaneda a écrit :
>>
>>> what are you trying to do?
>>> I never use that option, if you close it, it return 0, if you click the
>>> second button it returns 1
>>> so depends on what are you trying to achieve and you don't have to define
>>> all options all the time, just what you need
>>>
>>>
>>> On Fri, Feb 14, 2014 at 12:02 PM, Dominik Kirouac <dk at shedmtl.com>
>>> wrote:
>>>
>>>  I have some problemes with this command --- hou.ui.displayMessage() ---
>>>> the close_choice doesn't seem to work.
>>>>
>>>> If I  skip it, the message window work, but I can't escape or close the
>>>> dialog box.
>>>>
>>>> If I set it to None it ask me for an int.
>>>> If set it as an int, it works like if I had skip this argument in the
>>>> expression, I can't escape or close the dialog box.
>>>>
>>>> anyone can shed some light on this.
>>>>
>>>> Here the error msg
>>>>
>>>>
>>>>  hou.ui.displayMessage("Select Pipeline Step", buttons= ("R&D",
>>>>>>>
>>>>>> "Shot",), default_choice = 1 , close_choice=None, help = None ,
>>>> title="Pipeline Step",details=None, details_expanded=False)
>>>> Traceback (most recent call last):
>>>>    File "<console>", line 1, in <module>
>>>>    File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.314/houdini/python2.7libs\
>>>> hou.py",
>>>> line 58835, in displayMessage
>>>>      return _hou.ui_displayMessage(*args, **kwargs)
>>>> TypeError: in method 'ui_displayMessage', argument 6 of type 'int'
>>>>
>>>> thanks
>>>>
>>>>
>>>> *Dominik Kirouac // SHED **
>>>> *FX Artist
>>>> 1410, RUE STANLEY, 11E Étage MONTRÉAL (QUÉBEC) H3A 1P8
>>>> T 514 849-1555 F 514 849-5025 WWW.SHEDMTL.COM <http://www.shedmtl.com/>
>>>>
>>>> _______________________________________________
>>>> Sidefx-houdini-list mailing list
>>>> Sidefx-houdini-list at sidefx.com
>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>
>>>>  _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>
>>
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>
>



More information about the Sidefx-houdini-list mailing list