Kivy listview text alignment - python

Is it possible to have dynamic text alignment with kivy listview?
I have a list of responses from a web lookup.
I would like to have the text alignment (left or center) of each list item depending on the quality of the response item.
I can't find a way to access 'halign' for each list item.

You can use your own item class, I think this is an option on the ListAdapter (maybe named cls). In doing so, you can add whatever logic you like to how the item is displayed.

Related

How to get the selected item in a ComboBox?

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?

Is there a way to automatically input text in the different text box using Python Selenium?

I wanted to test a registration form with a lot of text boxes. Instead of manually using the .sendkeys() to each text box, is there a way to automatically input texts into each and every textbox in the page?
If I understand your question correctly, you'd like to have as little lines of code as possible for a form of text boxes with each their individual xpaths?
A way to do this you could use a list of xpaths (and text), which you iterate through and fill in automatically.
Note, you'd probably want to add a WebdriverWait to wait for the element to be loaded on the screen but this snippet might help you on your way.
# list of tuples consisting of a xpath and text to fill in that textbox
my_list = [('//*[#id="textbox_email"]', 'example#email.com'), ('//*[#id="textbox_password"]', 'pwd123'), (..., ...)]
for xpath, text in my_list:
driver.find_element_by_xpath(xpath).send_keys(text)
You may use page factory to store the locators and use from there every time or you can try the Data/Text driven framework also.

Loading images and text in pyqt

Im not sure what this is called, so its hard to lookup. I want to get a set of images that have a unique identifier and the put some corresponding text information next to it, inside of an application. When more images are loading a scroll bar can go through them. I dont know which methods or how this is possible. For example, through other threads i found how to load images using a list widget and switching the items to an icon. However with this method I dont see how to put text next to it. Can this be done with a table, or a tree? I have been using qt Designer but I dont see anything like this available.
You can use QListWidget for that. Each item would represent an image (item's icon) and all text to the right of it. Define iconSize property of list widget to enlarge item icons. Use \n in item texts to add line breaks.

Using QFrame to display different panes of information?

I'm trying to get a QFrame to serve as a "display area" for a couple different kinds of information, eg: you click on something in a list view and an info pane shows up in the frame
to give you information about it, you click on a different item and a different pane shows up.
Having trouble swapping the different frames in and out of the QFrame though, is there a way to do this?
Using QStackedWidget is probably the most standard solution.

Equivalent of an HTML multiple SELECT box in wxPython

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.

Categories

Resources