I am trying to extract the selected value from a ComboBox with combo_box.selected_text() through the win32 backend, with no success as each time my mouse is hovering on another not selected item, this function returns the hovered item's text and not my selected item's text.
Am I missing something or is this intentional behavior on onHover event?
I've tried numerous ways to extract the selected value + tried to understand if the combo box list is visible (which means the user might hover over some items) but with no success at all.
I noticed (through Accessibility Insights) that there is a certain property in ComboBox item indicating the selectedValue, how do I extract it?
Related
Overview: I have a QListView that displays the names of cities. I use MultiSelection as my selection type so the user can single click on a line to select a city, or multiple cities, without having to use Ctrl. MultiSelection allows the user to click and drag over items in the QListView, but it doesn't trigger a click event, so in another window where I display ONLY the user's selected items, it doesn't update to show what the user just selected. If the user then selects another city, then the click event is triggered and the full list of selected indices gets sent to the QListView object that displays the user's selections.
Problem: I need to be able to ensure that a click event occurs following the users drag-selection, so that the list displaying the selected indices is updated.
I didn't include any code because you either know or you don't know how this is done.
As #musicmante says, using selectionModel and selectionChanged is the way to go, but keep in mind that every time you invoke the setModel method, it resets the selectionModel. So anywhere you're using setModel, it would need to have this after it:
yourQListView.setModel(to_whatever)
yourQListView.selectionModel().selectionChanged.connect(theMethodYouWantToRun)
Okay so I created a list of items and each list has a specific information that I want to always show up when the list is clicked. So my question is what is the right code to put in the list that when clicked or on release, shows the information like a dialog box then okay button to close the dialog
I am curious to know if I can print something like "Loading.." on the screen for a while after clicking a value in dash dropdown.
sample dropdown :https://dashr.plotly.com/dash-core-components/dropdown from dash website
I just want to let the user know that the results are being fetched for the option he has selected from the drop down list and then display the results.
There is a Loading Component in dash core :
The Loading component can be used to wrap components that you want to
display a spinner for, if they take too long to load. It does this by
checking if any of the Loading components' children have a
loading_state prop set where is_loading is true. If true, it will
display one of the built-in CSS spinners.
You will find some examples in the documentation page.
I'm displaying some data as a TreeView. How can I detect a click on a particular tree-view cell, so that I know which column of which row was clicked on?
This is what I want to do, so maybe there's a better way: Part of the data is a series of True/False values indicating a particular set of options. For example, the options might be picking any of the options "Small, Medium, Large, X-Large" to be display. If the user selects "Small" and "Large", then the cell should display "Small, Large". I don't want to give each a separate column since there are actually like 20 options, and only 2 or 3 will be selected at any point.
When the user clicks on the cell, I want to display a pop-up with a bunch of checkboxes. The user can then select what s/he wants and submit the changes, at which point the cell's value should be updated.
The easiest way I thought of doing this would be to just detect a click (or a double-click) on the cell. Then I could pop up the window, and have the submit button of the window do what I want.
The row-activated signal is sent when a GTK TreeView row is double-clicked.
Ah from this grea tutorial and the API docs, I can just connect to the row-activated event, which will give me all the information I need.
I'd like to create a ListBox in wxPython with the same semantics as a multiple select box in HTML. Specifically I'd like the following semantics
When the user clicks on an entry in the list, all other entries become de-selected and the clicked entry becomes selected. If the entry was already selected then it stays selected.
When the user holds down the Ctrl key while clicking on an entry, all other entries stay unchanged, but it toggles whether the clicked entry is selected.
When the user holds down shift and clicks on an entry, that entry and every entry between it and the last clicked entry become selected.
In Java I get this by using the JList class in Swing and setting the selection mode to MULTIPLE_INTERVAL_SELECTED. I assume that there's a way to do this with the wxPython toolkit, but I can't figure out how to get a ListBox or ListCtrl or any other class to do this short of doing an enormous amount of event-driven programming myself.
I think what you're looking for is the wxLB_EXTENDED list box style. Specify style = wx.LB_EXTENDED when you create the ListBox.
You can then use the GetSelections method to obtain a list of the selected items.