Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11374 > unrolled thread
| Started by | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| First post | 2011-08-14 10:41 +0200 |
| Last post | 2011-08-17 17:20 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.python
monitor mouse coordinates in real-time Jabba Laci <jabba.laci@gmail.com> - 2011-08-14 10:41 +0200
Re: monitor mouse coordinates in real-time TheSaint <no@nowhere.net.no> - 2011-08-14 19:00 +0800
Re: monitor mouse coordinates in real-time Jabba Laci <jabba.laci@gmail.com> - 2011-08-14 18:39 +0200
Re: monitor mouse coordinates in real-time Jabba Laci <jabba.laci@gmail.com> - 2011-08-17 17:20 +0200
| From | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| Date | 2011-08-14 10:41 +0200 |
| Subject | monitor mouse coordinates in real-time |
| Message-ID | <mailman.2262.1313311295.1164.python-list@python.org> |
Hi, I wrote a simple GUI with pygtk to monitor mouse coordinates in real-time. It works but when I close the application, the thread doesn't stop and I can't figure out how to terminate it. Here is the current source: https://gist.github.com/1144708 (83 lines). Could you please help me out how to close the application correctly? Thanks, Laszlo
[toc] | [next] | [standalone]
| From | TheSaint <no@nowhere.net.no> |
|---|---|
| Date | 2011-08-14 19:00 +0800 |
| Message-ID | <j289sm$m7g$1@speranza.aioe.org> |
| In reply to | #11374 |
Jabba Laci wrote: > Could you please help me out how to close the application correctly? > I think you should put a flag into the code, which the parent might modify it, so it will tell the child process to quit. Then the flag should need to be read periodically to know whether is time to quit.
[toc] | [prev] | [next] | [standalone]
| From | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| Date | 2011-08-14 18:39 +0200 |
| Message-ID | <mailman.2279.1313340003.1164.python-list@python.org> |
| In reply to | #11383 |
I'm trying something similar. In the thread there is a variable which is modified by the parent. However, the thread doesn't quit the infinite loop. If someone could provide a patch, that'd be really useful. Thanks, Laszlo On Sun, Aug 14, 2011 at 13:00, TheSaint <no@nowhere.net.no> wrote: > Jabba Laci wrote: > >> Could you please help me out how to close the application correctly? >> > I think you should put a flag into the code, which the parent might modify > it, so it will tell the child process to quit. > Then the flag should need to be read periodically to know whether is time to > quit. > > -- > http://mail.python.org/mailman/listinfo/python-list >
[toc] | [prev] | [next] | [standalone]
| From | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| Date | 2011-08-17 17:20 +0200 |
| Message-ID | <mailman.131.1313594477.27778.python-list@python.org> |
| In reply to | #11401 |
Hi,
Thanks, the problem got solved. The updated version can be found at
https://gist.github.com/1144708 in a comment below the original post.
Solution:
self.connect("destroy", self.quit)
def quit(self, widget):
self.mouseThread.kill()
gtk.main_quit()
It was not evident that quit() must be passed the argument "widget" too.
Thanks,
Laszlo
On Wed, Aug 17, 2011 at 16:48, MrJean1 <mrjean1@gmail.com> wrote:
> Check that the app.quit method registered with atexit is called. E.g.
> on Windows, that may not be the case.
>
> /JeAN
>
>
> On Aug 14, 9:39 am, Jabba Laci <jabba.l...@gmail.com> wrote:
>> I'm trying something similar. In the thread there is a variable which
>> is modified by the parent. However, the thread doesn't quit the
>> infinite loop. If someone could provide a patch, that'd be really
>> useful.
>>
>> Thanks,
>>
>> Laszlo
>>
>>
>> On Sun, Aug 14, 2011 at 13:00, TheSaint <n...@nowhere.net.no> wrote:
>> > Jabba Laci wrote:
>>
>> >> Could you please help me out how to close the application correctly?
>>
>> > I think you should put a flag into the code, which the parent might modify
>> > it, so it will tell the child process to quit.
>> > Then the flag should need to be read periodically to know whether is time to
>> > quit.
>>
>> > --
>> >http://mail.python.org/mailman/listinfo/python-list
>
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web