I'm trying to make a desktop application using pyqt5 because I need it to be cross platform but the UI is very inconsistent from a platform to another (the position of the widgets on the screen is different and sometimes they're on top of other widgets).
I'm new to pyqt5 and python in general so can you tell me why this is happening and how to fix it if possible?
PS: i'm using Qt designer to generate the UI and you can find all the code here
here are some examples:
on windows 10
on linux mint (ignore the missing images)
Related
I have an app written on python + PyQt5. When I'm launching it from source it uses MacOS system appearance -- light colors for light appearance and dark for dark. But when I build the app using Pyinstaller it ignores system styles completely, and always use light color mode.
How can I automatically apply system styles to my widgets, or at least detect system appearance and do it manually?
Thank you in advance.
I am trying to extract labels of widgets of running GTK applications. I tried using GtkParasite but I have no idea how to get it working in my python program.
I want to be able to get the widgets and their labels of a gtk application that is running on my computer. It means that if I run gedit on my system then i want to get the labels of the widgets at run time. I hope this makes sense.
Is there a way to use the C library of GTK to get an instance of a running GTK application?
Thanks in advance.
You probably should use accessibility libraries - those are tools that allow eg. screen readers to read GUI labels for visually impaired users. On Linux, at-spi2 seems to be the de-facto standard.
For Python, take look at at-spi examples:
https://github.com/infapi00/at-spi2-examples
I have a python application using PySide, Qt and python. In my application I would like to open and display a pdf document, but have the viewer within the application and not using the default viewer on the operating system.
I have not as of yet been able to find a widget which is capable of doing this or some example code. I have never used these tools before and this is my first Qt & PySide application so I am sure there is a widget which is capable of this but that I am just not aware of it.
I found this post and when I take the sample code I am unable to get any pdf to show and cannot replicate the behaviour of the poster, but I am using python 2.7.3, PySide 1.1.1 so perhaps this is why. The error that I get when trying to run the sample code in the other post is:
QWebInspector: QSettings couldn't read configuration setting [resourceTrackingEnabled].
and the pdfs I would like to render are saved locally, in the same directory as the the python script and not accessible via the web.
Could somebody point me in the direction of some sample code or a Qt widget which I would be able to use to render a pdf?
As an aside, I am not sure that it matters but the pdf will be generated using LaTeX.
Edit --More information--
The program has to run on both Windows and Mac OSX environments but it is just for a personal project which wont be distributed. Using PyQt is not an option as it is not compatible with the python editor that I use and PySide is the requirement. I have read the following link but from what I understood under the Rendering section it said that the 3rd party libraries available worked with C, C++ and Qt not python or PySide but maybe I have misunderstood this?
I'm developing a program in python with a gui in pyqt4.
Now i have some porblem with the design of my buttons.
They have some style like windows 98 and i don't like that.
I have change my theme of my raspberry but nothing changed in my python application.
The theme changed my raspberry but not my application.
I use LXDE on my raspberry.
Do have anybody some solution?
Thanks,
You can change style of the Qt Application using one of the built in styles from Qt, for example you can use:
app.setStyle('plastique')
There are QWindowsStyle, QPlastiqueStyle, QCleanlooksStyle, QGtkStyle, QMotifStyle, QCDEStyle...
or you can use QSS (Qt Style Sheets) to theme your application, docs are here: http://qt-project.org/doc/qt-4.8/stylesheet.html
I have PyQT v.4.8.8 installed.When I draw layouts and I want to view the code , it comes with error that is unable to launch uic as in snapshot:
I can compile the .ui files manually in cmdLine. But I dont know where to put the code for slot,methods ,signals.
1- Where should I set the settings for finding uic to compile ui? My installation does not have pyuic4.
2 - Where can I define my own slots/methods and functoins signatures ? (receiver object,sender) I can see the Edit signals/slots in edit menu but that only shows standard signals/slots.Doesn't have options to define yours.
As the name says, the Qt designer is for interface design only. You cannot use it to write the code for the actual application logic. For this, you'll need a normal Python editor. The exact details on how to use designer files in Python are explained in PyQt reference guide, Using Qt Designer.
Btw, uic is not for PyQt, but for compiling user interfaces into C++. To compile user interfaces to Python, you need to use pyuic4. This tool cannot be run from the designer, you need to run it manually. But it is recommended to load the user interface dynamically at runtime using the PyQt4.uic modules as explained in the reference guide.
I found this tutorial for PyQt4 explaining how to add your own slots in Qt4.Very informative.