Loading images and text in pyqt - python

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.

Related

Drag and drop without QLineEdit (or at least doesn't require user to highlight the text)

I am trying to make a drag and drop system with blocks of text provided by the code, so I want the user to be able to drag and drop the text boxes for the purpose of placing and reordering some items, but the only way I can see how to do it is using a QLineEdit and making it read only. The issue is, the user still has to highlight the text here, and can highlight only part of it if they wanted. I want to make sure that the user can just click and drag, without highlighting, and has to move the whole box, not just some text inside.

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.

Kivy listview text alignment

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.

Search text and scroll down with qwebview

I'm using Qwebview with Pyside/Qt to view an HTML page on a GUI I'm working on.
I need the possibility to add a search text function, otherwise it is useless for the purpose the GUI is made.
I've searched but I didn't find anything useful for build a code that search the text and scrolls down the page as it is made in the common browsers.
The only function I found is findText but it returns a boolean and I cannot see how it can be useful.
Do somebody have an hint / advice / guide or code for this request?
Thank you.
Okay, so it turns out that i had an example of this using a QTextBrowser, which has a lot of this built into utility functions.
You can still do it with a QWebBrowser though.
Bind ctrl-f to open a search panel, and then make it so that the search box sends out two signals;
(presuming it's a QLineEdit), returnPressed, and textChanged.
Each of them then calls findText on the QWebPage object.
The important part is setting the correct flag in the findText call (which you'll want to set with checkboxes in your search functionality, i'd say).
You set the flags so that HighlightAllOccurrences is not set.
I cannot see any way to get details on a selection. Are you sure that when you do not set the HighlightAllOccurences flag it does not scroll to the next selection automatically?

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.

Categories

Resources