Zenity have provide any option to hide the button ?

2.6k Views Asked by At

I'm looking to create a dialog that required the user input to enable the OK button.

I'm going to write a shell script to trigger that action. May i know zenity have any option that can hide the button before the user type any input?

This is my script:

DISPLAY=:0.0 zenity --entry \
--title="Testing!" \
--text "Would you like to do something?\nPlease provide a valid reason:" \
--ok-label="OK" \
--cancel-label="Cancel" 2>/dev/null &
1

There are 1 best solutions below

1
On

It's hard to make such things with shell dialogs , in zenity i don't think you can do anything to the buttons, but then there is yad a fork of zenity that has some other options like hiding buttons, but you still can't know when the user inputs anything before he presses enter,

So you can keep showing a dialog with no buttons till the user inputs anything to the dialog and then show the buttons but every time the user needs to either press "enter" or click "ok"

here's the way you can do it

x='';while [ -z $x ] ; do x=`yad --entry --no-buttons  --title="Testing!" --text "Would you like to do something?\nPlease provide a valid reason:"`; done;yad --entry --title="Testing!" --text "Would you like to do something?\nPlease provide a valid reason:"  --entry-text=$x