[Help] I can't for the life of me figure out how to add a checkbox
See original GitHub issueFirst of all Gooey is amazing. I discovered it two days ago and have already reduced a colleague’s two day job down to 5 MINUTES!
Anyway, I decided to add a checkbox, but keep getting the error list index out of range
.
I have followed the Dev’s advice in a related issue [#148 ] word for word and letter for letter, but cannot seem to fix this.
All I want is a store_true
check box, which by default is False
.
My args:
@Gooey(program_name="Moneyback Calculator", default_size=(710, 500))
def parse_args():
parser = GooeyParser(description='Create Monthly MoneyBack Report')
parser.add_argument('Transaction_File',
metavar='Transaction Files',
action='store',
widget='FileChooser',
help="Upload Your File Containing All Transactions Here")
parser.add_argument('Smart_Rewards_File',
action='store',
metavar='Smart Rewards File',
widget='FileChooser',
help="Upload The anPost Smart Rewards File Here")
parser.add_argument('Choose_File_Name',
action='store',
metavar='File Name',
help="Choose A File Name For Your Report")
parser.add_argument('Output_Directory',
widget='DirChooser',
metavar='Output',
action='store',
help="Output Directory To Save Report")
parser.add_argument('Action',
widget='CheckBox',
metavar='Completed File',
action='store_true',
default=False,
help="Open Excel File Once Complete?")
args = parser.parse_args()
return args
If I tick the box, I get the error:
Traceback (most recent call last):
File "C:\Users\seanc\Anaconda3\lib\site-packages\wx\core.py", line 3259, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\containers\application.py", line 87, in onStart
if config.isValid():
File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\config.py", line 50, in isValid
states = [widget.getValue() for widget in self.reifiedWidgets]
File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\config.py", line 50, in <listcomp>
states = [widget.getValue() for widget in self.reifiedWidgets]
File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\widgets\bases.py", line 133, in getValue
'cmd': self.formatOutput(self._meta, value),
File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\widgets\checkbox.py", line 45, in formatOutput
return formatters.checkbox(metatdata, value)
File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\formatters.py", line 9, in checkbox
return metadata['commands'][0] if value else None
IndexError: list index out of range
And if I don’t tick the box, nothing happens.
Help? I have googled everywhere and can’t find an answer.
If more code is needed I will add it. It needs to be anonymized, which is why I just posted the args in case that’s all that’s needed.
Thank you
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Two ways to add checkbox controls to a Word document
Right-click anywhere on the ribbon's background and choose Customize the Ribbon. Check the Developer item in the list to the right. Click OK....
Read more >How to Insert a Checkbox in Word - freeCodeCamp
You'll see the "Check box" option on that Developer ribbon, around the middle. If you click on it, a checkbox will be added...
Read more >Add a check box or option button (Form controls)
Add a check box or option button (Form controls) · To add a check box, click the Developer tab, click Insert, and under...
Read more >Insert a Check Box in Microsoft Word - Lifewire
Placing check boxes in your document strictly for visual purposes, whether on paper or on screen, is a simple process. You can't add...
Read more >Insert checkbox in Excel: create interactive checklist or to-do list
As already mentioned, to be able to capture the checkbox state (checked or unchecked) you need to associate the check box with a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So you’re doing something which is confusing. An argument name such as ‘Action’ suggests a
Positional Parameter
(which is no optional); and on the other hand,store_true
suggests an Optional Parameter (which may or may be not specified).If you try the same with argparse instead of Gooey you will see it doesn’t work there as well.
So your solution is to add two dashes before the word Action.
OK, good idea. Thanks for your help. Closing this issue now.