New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.addGrid(my_list, addRow=True) error in Windows 7 environment #151

Closed
slightlynybbled opened this Issue Apr 20, 2017 · 6 comments

Comments

Projects
None yet
2 participants
@slightlynybbled

Windows 7
Python 3.5
appJar 0.052 (used pip to install)

Code:

app.addGrid(
    'airflow_data_raw',
    [
        ['Nozzle Diameter', 'Number of Nozzles', 'Differential Pressure', 'Static Pressure', 'Voltage', 'Current', 'Frequency'],
    ],
    row=1,
    column=0,
    colspan=3,
    addRow=True
)

The button doesn't show up well:

button

Additionally, when pressed, the button throws an error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python35-32\lib\tkinter\__init__.py", line 1550, in __call__
    return self.func(*args)
  File "C:\_virtual_env\appjar\lib\site-packages\appJar\appjar.py", line 1986, in <lambda>
    return lambda: funcName(param)
TypeError: 'NoneType' object is not callable
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 20, 2017

Owner

Great to see someone trying out the beta widgets!

Grid is probably the MOST beta - sorry!

The button on the addRow needs a function to call. Currently, it assumes a function has been assigned to the action variable. So tries to call that, passing the String newRow.

Now, in your case, no action has been set - so it's bombing out.

However, setting action will also cause Press buttons to appear at the end of each row - probably not what you want?

Short-term, you can populate the action parameter, long term, I think the function call should be changed - so that both action & addRow default to None and expect functions as parameters?

Owner

jarvisteach commented Apr 20, 2017

Great to see someone trying out the beta widgets!

Grid is probably the MOST beta - sorry!

The button on the addRow needs a function to call. Currently, it assumes a function has been assigned to the action variable. So tries to call that, passing the String newRow.

Now, in your case, no action has been set - so it's bombing out.

However, setting action will also cause Press buttons to appear at the end of each row - probably not what you want?

Short-term, you can populate the action parameter, long term, I think the function call should be changed - so that both action & addRow default to None and expect functions as parameters?

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 20, 2017

Owner

The squashed button is linked in to the above assumption.

The extra column, where the Press button is being drawn, gets created when the buttons are added to the previous rows. As no action function was set, the buttons weren't created above, and the header cell wasn't drawn.

Again, short-term - setting the action variable will fix the squashed button...

Owner

jarvisteach commented Apr 20, 2017

The squashed button is linked in to the above assumption.

The extra column, where the Press button is being drawn, gets created when the buttons are added to the previous rows. As no action function was set, the buttons weren't created above, and the header cell wasn't drawn.

Again, short-term - setting the action variable will fix the squashed button...

@slightlynybbled

This comment has been minimized.

Show comment
Hide comment
@slightlynybbled

slightlynybbled Apr 20, 2017

I tried that, but it still doesn't add a new row:

def dummy(*args):
    print('dummy function executed', args)

app.addGrid(
    'airflow_data_raw',
    [
        ['Nozzle Diameter', 'Number of Nozzles', 'Differential Pressure', 'Static Pressure', 'Voltage', 'Current', 'Frequency'],
    ],
    addRow=True,
    action=dummy
)

Basically, there is never a row added.

slightlynybbled commented Apr 20, 2017

I tried that, but it still doesn't add a new row:

def dummy(*args):
    print('dummy function executed', args)

app.addGrid(
    'airflow_data_raw',
    [
        ['Nozzle Diameter', 'Number of Nozzles', 'Differential Pressure', 'Static Pressure', 'Voltage', 'Current', 'Frequency'],
    ],
    addRow=True,
    action=dummy
)

Basically, there is never a row added.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 20, 2017

Owner

No, that will just fix the button. You have to manage adding a new row yourself.

Pressing the Press button will just call your dummy(*args) function.

Your dummy(*args) function would need to call app.getGridEntries(title) to get the data typed in, as a list. You should then process that data, before adding a new row to the grid using app.addGridRow(title, data)

If you don't want to do any processing, you can simply add the following code to dummy(*args):

if args[0]=="newRow":
        app.addGridRow('airflow_data_raw', app.getGridEntries('airflow_data_raw'))
Owner

jarvisteach commented Apr 20, 2017

No, that will just fix the button. You have to manage adding a new row yourself.

Pressing the Press button will just call your dummy(*args) function.

Your dummy(*args) function would need to call app.getGridEntries(title) to get the data typed in, as a list. You should then process that data, before adding a new row to the grid using app.addGridRow(title, data)

If you don't want to do any processing, you can simply add the following code to dummy(*args):

if args[0]=="newRow":
        app.addGridRow('airflow_data_raw', app.getGridEntries('airflow_data_raw'))

jarvisteach added a commit that referenced this issue Apr 20, 2017

New branch to investigate #151 & #152
Fixed width of button/entry

NB. temporarily turned off fonts, as tcl is a bit broken on my machine
right now…
@slightlynybbled

This comment has been minimized.

Show comment
Hide comment
@slightlynybbled

slightlynybbled Apr 21, 2017

Ahh, I see. I must have missed that in the docs. Will do.

Ahh, I see. I must have missed that in the docs. Will do.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 21, 2017

Owner

Ha - it's not really documented, I've created a new branch to look into the Grid widget, and have already updated the docs to reflect how it works...

Owner

jarvisteach commented Apr 21, 2017

Ha - it's not really documented, I've created a new branch to look into the Grid widget, and have already updated the docs to reflect how it works...

jarvisteach added a commit that referenced this issue Apr 24, 2017

Replaced colour names with colour codes
Updated grittiest code (#151)

Removed colour names - silver was having issues - better to switch all
to hex codes.

@jarvisteach jarvisteach self-assigned this May 26, 2017

@jarvisteach jarvisteach added this to the 0.07 milestone May 26, 2017

jarvisteach added a commit that referenced this issue Aug 2, 2017

Fixes to grid class
Initial fixes for #151, #152, #158

@jarvisteach jarvisteach closed this Aug 2, 2017

jarvisteach pushed a commit that referenced this issue Aug 13, 2017

Richard Jarvis
Improvements to SimpleGird #151
* Fixed ScrollRight typo
* adding a row, now hides & shows entries, instead of hiding then
creating new ones
* removed numRows variable - now simply count rows in data

Also, updated showCase for new getLstBox function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment