Master PyQt5 part 9: Style with Qt StyleSheets

  Рет қаралды 15,979

Alan D Moore Codes

Alan D Moore Codes

Күн бұрын

Пікірлер: 12
@HenrikEnquist
@HenrikEnquist 2 жыл бұрын
Great tutorials! Thank you! One thing I encountered was that the text cursor has to be placed before the search string in the 'textedit' widget. Otherwise, the search function will not find the search term. This is taken care of when loading text from file, but not when manually entering text. (This applies to the previous 'textedit' tutorials in this series as well.)
@imadetheuniverse4fun
@imadetheuniverse4fun 2 жыл бұрын
Hey Alan, any advice on how to get a stylesheet to apply to a custom subclass of a QtWidgets class? Examples: class MyButton(QPushButton): def __init__(self): super().__init__() stylesheet = """ MyButton { background: red; } """ setting the above as the stylesheet doesnt work, whereas if I change the name from MyButton to QPushButton, it does work. But of course then all QPushButtons will have that style, which is not wanted.
@alexp4448
@alexp4448 4 жыл бұрын
This was a great video. Good job explaining everything. I am trying to understand how the styles are actually implemented though, like you referenced. I think QPainter is involved but the C++ docs are not very helpful on this topic. thanks
@mohamed-tm8kr
@mohamed-tm8kr 2 жыл бұрын
how do i add white text outlined with black borders so it can appear on any surface with QT designer? is there a code to add to the stylesheet in order for this to show up?
@danmusser5280
@danmusser5280 3 жыл бұрын
Thanks for the great video! A question, if I want the menu bar to have a different color background than the text-editor window, I tried creating an object name on the "self.menuBar" object and then in my variables at the bottom I assigned the color that I wanted it to be. It threw up an error that said, "menubar() takes no keyword arguments". I assume the menu bar isn't a widget, and maybe it's only possible to change widgets independently? Is there a way around this? By the way I just purchased your book, (it should come tomorrow), do you go into greater depth on this in the book?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Menu bars are a little different in that (by default) they aren't actual Qt widgets but a wrapper around the Operating System/Desktop environment's built-in menu functionality. This allows, for example, your menus to be in the global menu area on macOS. You should be able to set a name using the setObjectName method, but if it still won't accept styling, try calling the setNativeWidget(False) method to make Qt create the menu instead of using the built-in API.
@danmusser5280
@danmusser5280 3 жыл бұрын
Alan another quick question: If I have multiple layouts on my GUI app, (multiple layouts on the same window), is there something besides stylesheets that would allow me to customize the background color of each layout? Maybe even put a border around the layouts? This series is awesome I sure appreciate it, (I did purchase the book, but I couldn't find anything about this in it). Thanks!
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Easiest way to get a border is to build each layout on a QFrame, then play with the FrameStyle and lineWidth properties. You can customize the background color of a widget by creating a custom QPalette object and assigning it to the widget's palette property. Now if you want your color changes to affect every descendant widget on the frame as well, that's a bigger deal. I would say you'd want to sub-class QFrame or QWidget and maybe create a custom addChildWidget method that overrides the child widget's palette before adding it to the layout. Or, of course, you could use stylesheets. :-)
@mhagen
@mhagen Жыл бұрын
Hello Alan, I've got your book. Very helpful. But stylesheets are not going well for me. The problem is that they are hard to debug. If you mess up the syntax on a command, there is no Python error. Qt just refuses to render that command and the Python routine moves on to the next object. What techniques do you use to debug QT stylesheets? Is there a "verbose" or "logging" mode that I can turn on to see where things go sideways? This might be a nice topic for a video.
@justoneofthepeople7585
@justoneofthepeople7585 4 жыл бұрын
I need help please😢 with this problem. I am learning from your book GUI python. I have this when I try to convert the ui file into python file. 'pyuic5.bat' is not recognized as an internal or external command, operable program or batch file. i am using pycharm. what should I do I have tried for 4 days with no solution.😔
Master PyQt5 part 10: Make responsive GUIs with Threads
33:35
Alan D Moore Codes
Рет қаралды 19 М.
PyQt6 CSS Stylesheets (QSS)
21:34
CodersLegacy
Рет қаралды 8 М.
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 54 МЛН
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 165 МЛН
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 14 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 50 МЛН
Master PyQt5 part 11:  Application Infrastructure and Communication
33:51
Alan D Moore Codes
Рет қаралды 4,5 М.
QtDesigner and PyQt5:  The right and wrong way to use them together
37:16
Alan D Moore Codes
Рет қаралды 107 М.
Introduction to GUIs in Python with PyQt5
26:10
Clear Code
Рет қаралды 83 М.
15 Python Libraries You Should Know About
14:54
ArjanCodes
Рет қаралды 372 М.
Python Classes pt1:  5 Myths about Python Classes
18:39
Alan D Moore Codes
Рет қаралды 3 М.
PyQt5 Python Tutorial - 3: Style APP using CSS
8:36
ClarityCoders
Рет қаралды 22 М.
Create GUI App with PyQt5 - PART 1
30:25
Python Simplified
Рет қаралды 177 М.
PyQt5 Designer + Python Stacked Widget Walkthrough
18:22
Jekyll&HydeTutorials
Рет қаралды 39 М.
#3 Design login Form Qt and CSS
12:16
Hamza el bouti
Рет қаралды 56 М.
⚡️Супер БЫСТРАЯ Зарядка | Проверка
1:00
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 5 МЛН
Собери ПК и Получи 10,000₽
1:00
build monsters
Рет қаралды 2,4 МЛН