Modelling a Nx2 grid on wxPython

Hi all! :slight_smile:

I have this software where I use a wx.TextCtrl to grab input from the user. Every line is a Hour Value format. The software grabs this information and plots a graph. The person I’m working with says it will better for the end user to have like a excel table, where he/she will enter the values in the respective cell, like the figure below.

I would start with 24x2 cells, and if the user uses all of them, when he/she types ENTER at the last cell, the software would create a bit more. Of course, I’ll need to read from them and populate them from a file, but I guess this is the easy job. I can do that.

So, do you think this will be hard to implement? If so, I can convince them to leave this feature behind and focus on adding other features to the software. I’m quite new to Python and wxPython, so I’m accepting all the tips!

Thank you.

This is a job for the grid.
See the wxPython demo Grid.py.

Are you refering to this example?

Yes. Look through these examples.
P.S.: No, please look at wxPython/Phoenix, not Classic.
https://github.com/wxWidgets/Phoenix/blob/64e5d863f7833f10df6a0fbcf3221a730562224b/demo/Grid.py

1 Like

Thanks, but when I tried to run the code, says I don’t have the module run. Googling, I have found this website. I used the command on the top of the page to install the module, but I’ve got lot of errors. The last one says “No matching distribution found for run”.

Is there a way around this?

Thanks for the help! :slight_smile:

Download the complete demo as archive or clone the repository. Then run Grid.py. It requires the other modules from the directory.
Archives are available from here: Index of /wxPython4/extras

1 Like

Thanks. I’ve got the program running now. I only need to understand it to modify it now. :smiley:
It’s the GridCustTable.py.

When I click or use one of the last cells, the software create a new row of cells.