Search - User list
Full Version: hou.ui.readInput() Only output zero at the first tuple
Root » Technical Discussion » hou.ui.readInput() Only output zero at the first tuple
artchapter
No matter which button I press, It always output zero at the first tuple...

input = hou.ui.readInput("Test Button Output", default_choice=0, close_choice=-1)
print(input)
if input[0] == -1:
    print("exit")
if input[0] == 0:
    print("enter")
    
# It always output 0 on input[0] but it should be -1 if I press exit button or esc
sebd3dvfx
hello,
i'm experiencing the same issue actually on Houdini 19
alexwheezy
As it follows from the documentation: The integer is the index of the pressed button.

This is necessary for those cases when you have more than one button by default the button argument is 'OK', if you make a tuple containing more than one button it will return the corresponding index.
sebd3dvfx
yeah i had to replace our solution by a pyside dialog that support close event
sebd3dvfx
Hi,
It actually works using a Cancel Button and close_choice=1

result,comment = hou.ui.readInput("Add your entry:", title="String input", initial_contents="", buttons=("OK", "Cancel"),close_choice=1)
if result == 1 : return
else : return comment
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB