Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98419 > unrolled thread
| Started by | Andrew Diamond <adiamond1978@gmail.com> |
|---|---|
| First post | 2015-11-07 19:13 -0800 |
| Last post | 2015-11-09 05:24 -0500 |
| Articles | 9 — 5 participants |
Back to article view | Back to comp.lang.python
[Ubuntu] PyQt5 Andrew Diamond <adiamond1978@gmail.com> - 2015-11-07 19:13 -0800
Re: [Ubuntu] PyQt5 Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2015-11-08 06:36 +0100
Re: [Ubuntu] PyQt5 Laura Creighton <lac@openend.se> - 2015-11-08 11:20 +0100
Re: [Ubuntu] PyQt5 Andrew Diamond <adiamond1978@gmail.com> - 2015-11-08 08:03 -0800
Re: [Ubuntu] PyQt5 Chris Angelico <rosuav@gmail.com> - 2015-11-09 03:22 +1100
Re: [Ubuntu] PyQt5 Andrew Diamond <adiamond1978@gmail.com> - 2015-11-08 08:27 -0800
Re: [Ubuntu] PyQt5 Terry Reedy <tjreedy@udel.edu> - 2015-11-08 18:05 -0500
Re: [Ubuntu] PyQt5 Laura Creighton <lac@openend.se> - 2015-11-09 03:41 +0100
Re: [Ubuntu] PyQt5 Terry Reedy <tjreedy@udel.edu> - 2015-11-09 05:24 -0500
| From | Andrew Diamond <adiamond1978@gmail.com> |
|---|---|
| Date | 2015-11-07 19:13 -0800 |
| Subject | [Ubuntu] PyQt5 |
| Message-ID | <d453cf4b-7a30-4b2c-9bff-53d488552671@googlegroups.com> |
Hi! I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all the examples I installed that handle code to quit the app. Running Ubuntu 15.10, and installed pyqt5 via: sudo apt-get install python3-pyqt5 sudo apt-get install qtcreator Thank you in advance for any assistance!
[toc] | [next] | [standalone]
| From | Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> |
|---|---|
| Date | 2015-11-08 06:36 +0100 |
| Message-ID | <mailman.117.1446961439.16136.python-list@python.org> |
| In reply to | #98419 |
Le 08/11/2015 04:13, Andrew Diamond a écrit : > Hi! > > I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all the examples I installed that handle code to quit the app. > > Running Ubuntu 15.10, and installed pyqt5 via: > > sudo apt-get install python3-pyqt5 > sudo apt-get install qtcreator > > Thank you in advance for any assistance! Works fine for me on 15.04. I've tested the first example with the menuBar. Have you a message into the terminal? Maybe an error? Vincent
[toc] | [prev] | [next] | [standalone]
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Date | 2015-11-08 11:20 +0100 |
| Message-ID | <mailman.122.1446978023.16136.python-list@python.org> |
| In reply to | #98419 |
In a message of Sun, 08 Nov 2015 06:36:26 +0100, Vincent Vande Vyvre writes: >Le 08/11/2015 04:13, Andrew Diamond a écrit : >> Hi! >> >> I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all the examples I installed that handle code to quit the app. >> >> Running Ubuntu 15.10, and installed pyqt5 via: >> >> sudo apt-get install python3-pyqt5 >> sudo apt-get install qtcreator >> >> Thank you in advance for any assistance! >Works fine for me on 15.04. > >I've tested the first example with the menuBar. > >Have you a message into the terminal? Maybe an error? > >Vincent A suggestion: When I get the 'it locks up when I want to quit' behaviour in PyQt4 it is because I have messed up something with my threading. PyQt4 wants there to be one, main control thread (that handles, among other things, shutting down) and lots of worker threads which do the gui-stuff, i.e. all the work that the program really needs to do. If you manage to structure things so that your control ends up in a worker thread, then when it is told to quit, your app sits around and waits for the main control thread to come back and deal with things, but your main control thread is dead, and therefore isn't coming. I assume you can get problems like this with Qt5 as well. Did quitting work properly with the earlier exercises of this tutorial, or did you try to start learning from the middle? Laura
[toc] | [prev] | [next] | [standalone]
| From | Andrew Diamond <adiamond1978@gmail.com> |
|---|---|
| Date | 2015-11-08 08:03 -0800 |
| Message-ID | <7056c802-308b-4d5c-961d-052ef2671633@googlegroups.com> |
| In reply to | #98419 |
On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond wrote:
> Hi!
>
> I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all the examples I installed that handle code to quit the app.
>
> Running Ubuntu 15.10, and installed pyqt5 via:
>
> sudo apt-get install python3-pyqt5
> sudo apt-get install qtcreator
>
> Thank you in advance for any assistance!
I just read somewhere that the issue could be because I was trying to run these examples from within Idle. However, when I try to run them from the terminal, I run into another snag:
andrew@andrew-Satellite-P755:~/Programming/Python$ python tut8.py
Traceback (most recent call last):
File "tut8.py", line 16, in <module>
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
ImportError: No module named PyQt5.QtWidgets
...a path issue?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-09 03:22 +1100 |
| Message-ID | <mailman.139.1446999736.16136.python-list@python.org> |
| In reply to | #98461 |
On Mon, Nov 9, 2015 at 3:03 AM, Andrew Diamond <adiamond1978@gmail.com> wrote: > On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond wrote: >> Hi! >> >> I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all the examples I installed that handle code to quit the app. >> >> Running Ubuntu 15.10, and installed pyqt5 via: >> >> sudo apt-get install python3-pyqt5 >> sudo apt-get install qtcreator >> >> Thank you in advance for any assistance! > > I just read somewhere that the issue could be because I was trying to run these examples from within Idle. However, when I try to run them from the terminal, I run into another snag: > > andrew@andrew-Satellite-P755:~/Programming/Python$ python tut8.py > Traceback (most recent call last): > File "tut8.py", line 16, in <module> > from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication > ImportError: No module named PyQt5.QtWidgets > > ...a path issue? If you installed "python3-pyqt5", you probably want to run "python3 tut8.py". There are potentially two completely separate Python interpreters installed - version 2.7, and the latest available version 3.x (probably 3.4 or 3.5). You've installed a package for Python 3, but haven't installed the corresponding Python 2 package, so it won't run under the Python 2 interpreter. Compare these: $ python --version $ python3 --version I suspect that "python3 tut8.py" should work. If it doesn't, post some more info about your Idle installation; it might give a hint as to what's going on. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Andrew Diamond <adiamond1978@gmail.com> |
|---|---|
| Date | 2015-11-08 08:27 -0800 |
| Message-ID | <5c057628-f45a-4734-bdda-8472c9ad9632@googlegroups.com> |
| In reply to | #98465 |
On Sunday, November 8, 2015 at 11:22:30 AM UTC-5, Chris Angelico wrote: > On Mon, Nov 9, 2015 at 3:03 AM, Andrew Diamond <adiamond1978@gmail.com> wrote: > > On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond wrote: > >> Hi! > >> > >> I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all the examples I installed that handle code to quit the app. > >> > >> Running Ubuntu 15.10, and installed pyqt5 via: > >> > >> sudo apt-get install python3-pyqt5 > >> sudo apt-get install qtcreator > >> > >> Thank you in advance for any assistance! > > > > I just read somewhere that the issue could be because I was trying to run these examples from within Idle. However, when I try to run them from the terminal, I run into another snag: > > > > andrew@andrew-Satellite-P755:~/Programming/Python$ python tut8.py > > Traceback (most recent call last): > > File "tut8.py", line 16, in <module> > > from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication > > ImportError: No module named PyQt5.QtWidgets > > > > ...a path issue? > > If you installed "python3-pyqt5", you probably want to run "python3 > tut8.py". There are potentially two completely separate Python > interpreters installed - version 2.7, and the latest available version > 3.x (probably 3.4 or 3.5). You've installed a package for Python 3, > but haven't installed the corresponding Python 2 package, so it won't > run under the Python 2 interpreter. Compare these: > > $ python --version > $ python3 --version > > I suspect that "python3 tut8.py" should work. If it doesn't, post some > more info about your Idle installation; it might give a hint as to > what's going on. > > ChrisA You were absolutely correct! $ python3 tut8.py ...worked great, thanks!!
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2015-11-08 18:05 -0500 |
| Message-ID | <mailman.151.1447023977.16136.python-list@python.org> |
| In reply to | #98461 |
On 11/8/2015 11:03 AM, Andrew Diamond wrote: > On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond > wrote: >> Hi! >> >> I'm fairly new to Python, and installed pyqt5 and began working >> through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ >> However, whenever I click one of the buttons or menus in the >> example apps I run that is supposed to quit the application, it >> locks up. What is 'it'? And what does 'lock up' mean? Did the gui freeze and not disappear? Or did IDLE itself freeze, and even the menu quit working? >> This happens with all the examples I installed that >> handle code to quit the app. >> >> Running Ubuntu 15.10, and installed pyqt5 via: >> >> sudo apt-get install python3-pyqt5 sudo apt-get install qtcreator > I just read somewhere that the issue could be because I was trying to > run these examples from within Idle. I am an IDLE maintainer. Am I to take it that everything ran fine before you tried to quit? If not, I would want to know why and try to fix. If you run tut.py from an IDLE editor, IDLE tries to run it the same as if you ran it at a console in the tut.py directory with 'python3 -i tut.py'. I can imagine that there might be a problem with the transition from gui mode to interactive shell mode, though it works for tkinter apps. You said 'python3 tut.py' works. What happens if you add the '-i' option? I'd like to know if the transition problem is in (Py)qt5 or in IDLE's simulation of '-i'. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Date | 2015-11-09 03:41 +0100 |
| Message-ID | <mailman.161.1447036880.16136.python-list@python.org> |
| In reply to | #98461 |
In a message of Sun, 08 Nov 2015 18:05:32 -0500, Terry Reedy writes: >On 11/8/2015 11:03 AM, Andrew Diamond wrote: >> On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond >> wrote: >>> Hi! >>> >>> I'm fairly new to Python, and installed pyqt5 and began working >>> through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ >>> However, whenever I click one of the buttons or menus in the >>> example apps I run that is supposed to quit the application, it >>> locks up. > >What is 'it'? And what does 'lock up' mean? Did the gui freeze and not >disappear? Or did IDLE itself freeze, and even the menu quit working? > >>> This happens with all the examples I installed that >>> handle code to quit the app. >>> >>> Running Ubuntu 15.10, and installed pyqt5 via: >>> >>> sudo apt-get install python3-pyqt5 sudo apt-get install qtcreator > >> I just read somewhere that the issue could be because I was trying to >> run these examples from within Idle. > >I am an IDLE maintainer. Am I to take it that everything ran fine >before you tried to quit? If not, I would want to know why and try to fix. > >If you run tut.py from an IDLE editor, IDLE tries to run it the same as >if you ran it at a console in the tut.py directory with 'python3 -i >tut.py'. I can imagine that there might be a problem with the >transition from gui mode to interactive shell mode, though it works for >tkinter apps. You said 'python3 tut.py' works. What happens if you add >the '-i' option? I'd like to know if the transition problem is in >(Py)qt5 or in IDLE's simulation of '-i'. > >-- >Terry Jan Reedy I suspect that Qt and Idle are disagreeing as to who gets to have the main thread around here. Laura
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2015-11-09 05:24 -0500 |
| Message-ID | <mailman.167.1447064719.16136.python-list@python.org> |
| In reply to | #98461 |
On 11/8/2015 9:41 PM, Laura Creighton wrote:
> In a message of Sun, 08 Nov 2015 18:05:32 -0500, Terry Reedy writes:
>>> I just read somewhere that the issue could be because I was trying to
>>> run these examples from within Idle.
First let me note that a) IDLE is meant for learning Python and
developing Python programs, and b) IDLE using tkinter/tcl/tk and
programs that introspect too deeply or interact with hardware can
interfere with each other. I recently added
https://docs.python.org/3/library/idle.html#idle-console-differences
to document some differences from console python.
Can IDLE be used for developing GUI programs? In the case of tkinter,
yes. For 3.x, at least, I believe there are advantages over plain
editors. For other gui packages, I would like to know what limitations
or problems there are so I can warn people against trying to do things
that will not work. Hence the questions below.
>> I am an IDLE maintainer. Am I to take it that everything ran fine
>> before you tried to quit? If not, I would want to know why and try to fix.
>>
>> If you run tut.py from an IDLE editor, IDLE tries to run it the same as
>> if you ran it at a console in the tut.py directory with 'python3 -i
>> tut.py'. I can imagine that there might be a problem with the
>> transition from gui mode to interactive shell mode, though it works for
>> tkinter apps. You said 'python3 tut.py' works. What happens if you add
>> the '-i' option? I'd like to know if the transition problem is in
>> (Py)qt5 or in IDLE's simulation of '-i'.
> I suspect that Qt and Idle are disagreeing as to who gets to have the
> main thread around here.
I doubt this is the specific problem because user code, here invoking
pyqt and qt, are run in a separate process. While it is running, I
believe the only Idle code that would run is in the substitute
stdin/out/err, which are only used if the user code calls input, print,
or .write() or raises. Instead of
> python3 -i mypyqt.py
at a console prompt, IDLE starts a subprocess with
> python -m idlelib.run mypyqt.py
The latter sets up socket communication, a locals namespace that
imitates __main__, and a few other things and then runs
exec(open(mypyqt.py).read(), locals).
I can imagine a few different ways things could get messed up, which is
why I asked the specific questions I did. For instance, if a program
rebinds the standard stream but does not restore them, because it
assumes that exiting the program mean exiting the process (as would
normally be the case with a gui program), then the '-i' option and the
IDLE simulation thereof may not work.
In thinking about this, I realized that I could test that idlelib.run at
least works with all stdlib modules by running the entire CPython test
suite in the execution process. I already run idle tests in IDLE while
developing them, but had never thought about the fact that I was testing
the run module also.
--
Terry Jan Reedy
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web