PyQt GUI application multiple pages [duplicate] - python

This question already has an answer here:
How to change window/widget with PyQt5 using .ui files?
(1 answer)
Closed 1 year ago.
So I am trying to create an application with multiple pages. I would like to have some kind of menu, that the user could use to navigate between different "pages" the application has.
I looked at QStackedWidget, but it seemed like in this case (using uic to load the ui) I would have to write the whole business logic (for all the pages) in a single class, and even if I managed to separate them to some degree, it just seems not that good of a solution. I would also not like to create a new window for every page, would be better to keep them on a single page and just switch on certain events.
I took a look at custom widgets, but I imagine the ideal usecase for those would be for reusability and not for a "page" in an application like this.
What would you recommend?

I managed to solve the problem with the help of this question. I was confused since the widget I added to the StackedWidget just wouldn't appear.

Related

Verify presence of GUI elements in console application

I am currently developing an automated test case which performs actions on a console application (very simple, just clicking buttons and inputting text).
I have been able to successfully click through the application and input data without many problems, which includes identifying elements and things like that.
I have not been able to verify the existence of GUI elements that aren't clickable, ie an image that is loaded into the console application. I have tried looking through the output when using print_control_identifiers() for any indication of where data about an image in the window might be stored. I have tried looking at the tree diagram of the windows before and after loading the image in to see if it changes (it does not).
I have also then looked into verifying basic things, like font type or other properties that exist in the VS development platform, without success. To do this I used handleprops.font among other things. I have also read through the handleprops class and tried to find anything in there that I can use, but none of it is working.
My question is: is there a way to access an image's information that is stored in the window? I am able to identify where it is stored (picturebox1) and get information about that window (handleprops.rectangle) but cannot get anything about whether the image is there (like a path to image for example). All I can access is 'controllable' items, those that show up in print_control_identifiers()
I'm not sure this is possible with pywinauto but I have been stuck on this for a while and wondered if there were any suggestions people had.
Thanks

DJango - Update text depending on dropdown selection?

My Google search skills evidently aren't up to scratch, so I'm wondering if Django has the capability to dynamically update text displayed on the HTML page depending on what option is selected from a dropdown?
Or would I need to look into utilising another tool to help with this?
Apologies for the noob question as I'm still learning Python/Django.
This can only be achieved via frontend scripting, so JavaScript. Depending on what you are using in your templates, you might have a possibility to use that library or write javascript yourself.
I think the easiest is to write it yourself. You could do it in the following way:
Create <div id="?">...</div> and populate with relevant text for all your options (change id="?" appropriately)
Show only the default one and hide the other
if you are using bootstrap[345] you can apply classes (d-none vs d-block)
write your own javascript
Then tie a "click" on the dropdown method to the activation of corresponding <div>
With the amount of information you supplied us with, this is the most I can suggest to you. I hope I interpreted your question correctly.

Is there a PyQt5 widget for drop-down "file explorer" menu?

I am working on a small project using PyQt5 (Python 3) and I want a widget where a user can select/modify a file, somewhat akin to the left-hand side of file explorer on Windows:
This cannot be done with QFileDialog as I want to display files that are not on the user's drive.
I have tried writing my own, however I am a beginner and I lack the skills to do it correctly (hence the reason why I'm trying to learn). I can provide the code if that would be useful.
Is there such a thing built in to pyqt? Has anyone created one before, with source code available?
Thanks in advance.
EDIT: More specifically I don't want a way to access remote files, just a widget that displays entries (along with icons, preferably) and subentries in a sort of drop-down menu, like the section of file explorer mentioned above. It doesn't necessarily have to be to do with files, consider it a drop-down menu if that helps.
I know this is old but for anyone looking for an answer it's the QTreeView widget.

Is it possible to create elements using Bokeh widget DIV that respond to bokeh server commands?

I've been using Bokeh's datatable, but there are a few things I'd like to do that I don't know how to accomplish using the DataTable class. For example, I don't think it's possible add icons (or any images) to different rows, or setting the table to single selection only. So, I've been thinking about implementing just a HTML table, and writing it with the DIV widget.
However, I'd still like to add interactive features to the table, like buttons, or the icons mentioned above. Then, when an event is generated (e.g. onClick), that event is captured by the Bokeh server, and I can write the handlers in Python to do things such as modifying the data in ColumnDataSource, for example.
Is this possible? Or is there a better way to accomplish this?
Thanks!
I think the approprate way to achieve what you want is to create a custom widget:
Extending Bokeh Documentation
Custom Widget Example
I do not paste here the complete example because it is too long.

Adding multiple icons in QComboBox with QAbstractItemDelegate pyqt

I wanted to set multiple icons in a single item in my QcomboBox. I think this can be implemented using the QAbstractItemDelegate, but I need some PyQt examples. The following link does give me an idea but I couldn't get in running with Python :
How to custome QCombobox with multiple comlumns
Thank you for the help.

Categories

Resources