How to add checkbox to wxGrid cell? - python

I have a bunch of data organized by rows. In the first cell of each row, I want to have a checkbox, so the user can go through and select certain rows.
I know I could make the user use CTRL + click each row, but I rather have checkboxs as this is a feature to be used a lot.

You can use checkboxes for any cell by explicitly setting it up to use wxGridCellBoolRenderer and wxGridCellBoolEditor, but the simplest way to use them is to just use boolean values for the cells in the first column, i.e. define a custom wxGridTable subclass which would return wxGRID_VALUE_BOOL from its GetTypeName() for the first column.
Then the checkboxes will be used automatically.
I'm sure you can find some examples in Python as well, but I can only point you to C++ grid sample, which should hopefully translate to Python in a straightforward way.

Related

Can I make a value span multiple rows in a treeview in tkinter?

I have a treeview, and I want the items in its uppermost layer to be categories, which then open up to the data. The problem is that I need to place the label of the category in one of my columns in the treeview, and it ends up looking cramped and ugly. I want to make the title ignore columns, spanning the entire row, but Google has not yielded results. Does anyone know how I can achieve such a thing?

Xlsxwriter hide data series in scatter plot

I have used xlsxwriter to add various different data series (lines) to a plot. What I would like to do now is disable certain series by default but, still have the disabled series available to reenable when looking at the graph.
For example, in the following image, while xlsxwriter adds all the series as I want it to, I would also like to not show "Sample2" & "Sample3" while showing "Sample1" by default.
The only feature I have been able to find that does something similar would be the:
# Delete/hide series index 0 and 2 from the legend.
chart.set_legend({'delete_series': [0, 2]})
It appears to "delete" it more than hide it because if I try to toggle them back on they don't show up.
Maybe it's not possible through xlsxwriter but is there any other way I can implement this functionality?
I hope you're enjoying your stay here lmao.
Delete/hide series index 0 and 2 from the legend.
chart.set_legend({'delete_series': [0, 2]})
This work?
If not...
for Mac:
Click on the chart.
On the ribbon, click Chart Design and then click Select Data.
On the Chart Design tab, click Select Data
This selects the data range of the chart and displays the Select Data Source dialog box.
To edit a legend series, in the Legend entries (series) box, click the series you want to change. Then, edit the Name and Y values boxes to make any changes.
To rearrange a legend series, in the Legend entries (series) box, click the series you want to change and then select the alternate text or alternate text arrows.
Windows:
Right-click your chart, and then choose Select Data.
n the Legend Entries (Series) box, click the series you want to change.
Click Edit, make your changes, and click OK.
Changes you make may break links to the source data on the worksheet.
To rearrange a series, select it, and then click Move Up alternate text or Move Down alternate text.
You can also add a data series or remove them in this dialog box by clicking Add or Remove. Removing a data series deletes it from the chart—you can’t use chart filters to show it again.
If you want to rename a data series, see Rename a data series.
I hope this is helpful to you.

Create two linked graph in Python

Good morning.
I am nwe to Python, I would need to make two "linked" graphs, so that the value in one of them could be selected (in the image the one on the right) and the other would be updated (In the image the one on the left)
The data is a "normal" dataframe with 5 columns, the graph on the right is the first column and depending on where you will select in that graph, update the 2nd graph with the data from the row, updating as the selection is changed.
I don't know how it could be possible in Python or what libraries to use.
Greetings and thank you

How to save hidden data to wxGrid cell?

I'm trying to create a column where there's a number shown, and after clicking the number, a URL is opened in the browser. Each row in the column will correspond to a different URL. However the URL is too long to display in a cell of its own, as there are a number of other columns to fit, and showing it is just not necessary. What's the best way to invisibly save data (the URL) to a grid cell?
One approach which works is a global variable, just keeping a list of URLs.
Another would be if there was a way to set the URL to the balloon/hover/caption text of individual cells, but I don't think you can set custom ToolTips to cells in wxPython.
Any ideas? Thanks so much.
You can do something along these lines:
Put all the urls in a dict using the numbers displayed in the grid as key.
a = {1:'http:\\www.google.com', 2:'http:\\www.twitter.com', 3:....}
Bind the selection events to an event handler which fetches the number shown in the selected cell and finds the corresponding url for that number from the dict.

Showing a table after rotating by 90 in wx-python

I have to display a table with multiple columns but only a single row. Displaying it in the normal way using wxGrid doesnt look appealing at all and makes it hard for the user to read. I want to know if there is any way in which I can flip the table and display its contents vertically? Also is there any other way to make the data more presentable?
Just label the rows with the column names and the make one column. Then you could scroll through it that way. You just need to call SetRowLabelValue(rowNum, label). You may find this tutorial helpful (see the end): http://www.blog.pythonlibrary.org/2010/04/04/wxpython-grid-tips-and-tricks/
You could use a ListBox, but then you'd lose the label information.

Categories