How do i Create a Zenity form with a check list in it
It would appear the --add-entry
option is not supported when --list --checklist
are used. I adapted your code to create:
#!/bin/bash
zenity --list --checklist --title="Options"\
--text="Select your features"\
--column="Use"\
--column="Feature"\
TRUE A\
False B\
zenity --forms --title="Create user" --text="Add new user" \
--add-entry="First Name" \
--add-entry="Last Name" \
--add-entry="Username" \
--add-password="Password" \
--add-password="Confirm Password" \
--add-calendar="Expires"
The first section you know what it looks like already. The second section looks like this:
The --add-entry
works on --forms
dialog box type but not on --list
dialog box type.
Credit for --forms code to: (Post on Stack Exchange)
Related videos on Youtube
rasmus91
Started using Linux in October 2007, a few days after the release of Ubuntu 7.10 Gutsy Gibbon. I've worked in an Microsoft Based ERP business as a sysadmin, and developer of admin/dev tools. Currently I am studying Software Engineering at a university.
Updated on September 18, 2022Comments
-
rasmus91 almost 2 years
I am trying to create a small GUI in Zenity, for it i a few text inputs coupled with a checklist. It seems however the only list i can add to a form is a list of fixed values, and not one with checkboxes in it. Is there any solution to this?
Basically it's something like this, but --checklist isn't available for forms, and i have no idea how else to put these things into the same window.
zenity --forms --title="Options"\ --text="Edit options"\ --add-entry="File:"\ --add-entry="Username:"\ --add-list="Features" --checklist\'
I tries adding values to the list, and columns, but doing this:
zenity --forms --title="Options"\ --text="Edit options"\ --add-entry="File:"\ --add-entry="Username:"\ --add-list="Features" \ --list-values="A|B|C" \
That did not help, however, as it just adds 3 strings in the list box. I thought i'd try to make a checklist containing other entries, so first i made a basic checklist.
zenity --list --checklist --title="Options"\ --text="Select your features"\ --column="Use"\ --column="Feature"\ TRUE A\ False B\
Piece of cake! Then i thought i'd just add an entry, just like in the forms:
zenity --list --checklist --title="Options"\ --text="Select your features"\ --add-entry="File:"\ --column="Use"\ --column="Feature"\ TRUE A\ False B\
It runs just as it should, but the text entry field is never displayed.
-
WinEunuuchs2Unix over 7 yearsCan you edit your question to include the zenity code with an explanation of what you've tried and what happened instead?
-
rasmus91 over 7 yearscode samples has been added :)
-
WinEunuuchs2Unix over 7 yearsNow its a very high quality question :)
-
-
rasmus91 over 7 yearsThanks. I eventually realised this and swotched to yad. Lists are still not supported in forms, but there are More elements to work with, particularly the field is very Nice.
-
WinEunuuchs2Unix about 7 yearsSince posting this answer I too switched to
yad
which is infinitely more powerful.