[SOLVED]PyQt5 tutorial - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [SOLVED]PyQt5 tutorial (/thread-38183.html) |
[SOLVED]PyQt5 tutorial - Barrowman - Sep-12-2022 I am trying to see if I want to use PyQt5 and am working my way through some tutorials. I haven't got very far yet. This one does not show the tooltip when I hover over the button. All I did was copy and paste from https://zetcode.com/gui/pyqt5/firstprograms/ #!/usr/bin/python """ ZetCode PyQt5 tutorial This example e shows a tooltip on a window and a button. Author: Jan Bodnar Website: zetcode.com """ import sys from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication) from PyQt5.QtGui import QFont class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget') btn = QPushButton('Button', self) btn.setToolTip('This is a <b>QPushButton</b> widget') btn.resize(btn.sizeHint()) btn.move(50, 50) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Tooltips') self.show() def main(): app = QApplication(sys.argv) ex = Example() sys.exit(app.exec_()) if __name__ == '__main__': main()QT version is 5.12.8 PYQT version is 5.14.1 Running Linux Mint 20.3 Cinnamon Python 3.8.10 RE: PyQt5 tutorial - deanhystad - Sep-12-2022 It works fine for me on windows. What is your OS? Or I could just scroll down a little further and see it is Mint. RE: PyQt5 tutorial - Barrowman - Sep-13-2022 (Sep-12-2022, 06:48 PM)deanhystad Wrote: It works fine for me on windows.So do you have any idea what I need to look at? Or can someone try from Linux to see if it's my setup or general in Linux please? RE: PyQt5 tutorial - Axel_Erfurt - Sep-13-2022 I just did some tests in Mint 21 and LMDE5. Tooltips are shown. I've been using PyQt5 since Mint 17 and never had problems with tooltips. RE: PyQt5 tutorial - deanhystad - Sep-13-2022 Also works fine with PySide6 on Windows 10 and Ubuntu 20.04. How do you run the program? RE: PyQt5 tutorial - Barrowman - Sep-13-2022 (Sep-13-2022, 05:35 PM)deanhystad Wrote: Also works fine with PySide6 on Windows 10 and Ubuntu 20.04. python3 ./classes3.pyto start with and the made it executable and got the same. on running it from the command line I got
RE: PyQt5 tutorial - Barrowman - Sep-15-2022 Just been trying to see if there was something missing on my system and now when I run qt5ct I get the following: Quote:qt5ctIs this normal or have I some conflicts causing the problem? RE: PyQt5 tutorial - Barrowman - Sep-15-2022 I decided to have a look at qt5ct.conf and found that one item was Quote:gui_effects=@Invalid()which seemed odd. S0 I deleted that line and tried running the code again. Well the tooltip worked so I thought I had sorted it out and tried another tutorial which had 2 buttons on it but that didn't work. Guess what???!!! the original doesn't work again. It was a one time only thing. What on earth is happening? RE: PyQt5 tutorial - Axel_Erfurt - Sep-15-2022 This my qt5ct.conf It also has gui_effects=@Invalid(). Nevertheless it works.
RE: PyQt5 tutorial - Barrowman - Sep-16-2022 (Sep-15-2022, 11:31 AM)Axel_Erfurt Wrote: This my qt5ct.confThanks Axel, Yesterday I ran another program I normally run from the menu but had trouble with it. I ran it from the command line and got the message about qt5ct so i removed a few qt5 related items via software manager. Then when I ran the original program I have had trouble with it reported that PyQt5 was missing. I installed Python3-qt5 and now it's all working fine. So I guess Python3-qt5 had been corrupted at some point or it may have been a bad version. |