Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Help] I can't for the life of me figure out how to add a checkbox

See original GitHub issue

First 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')

                        metavar='Transaction Files',
                        help="Upload Your File Containing All Transactions Here")

                        metavar='Smart Rewards File',
                        help="Upload The anPost Smart Rewards File Here")
                        metavar='File Name',
                        help="Choose A File Name For Your Report")

                        help="Output Directory To Save Report")

                    metavar='Completed File',
                    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\", line 3259, in <lambda>
    lambda event: event.callable(*event.args, ** )
  File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\containers\", line 87, in onStart
    if config.isValid():
  File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\", line 50, in isValid
    states = [widget.getValue() for widget in self.reifiedWidgets]
  File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\", line 50, in <listcomp>
    states = [widget.getValue() for widget in self.reifiedWidgets]
  File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\widgets\", line 133, in getValue
    'cmd': self.formatOutput(self._meta, value),
  File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\components\widgets\", line 45, in formatOutput
    return formatters.checkbox(metatdata, value)
  File "C:\Users\seanc\Anaconda3\lib\site-packages\gooey\gui\", 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:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

eladeyal-intelcommented, Sep 27, 2019

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.

soliverccommented, Sep 27, 2019

OK, good idea. Thanks for your help. Closing this issue now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found