Re: [Tutor] Tkinter mainloop()
Il 07/07/2010 9.11, Alan Gauld wrote: Francesco Loffredo ilcomputertraspare...@gmail.com wrote ... What's the difference between the two methods? Its a little bit subtle but I believbe update() updates all widgets whereas update_idle_tasks will only update those widgets that have changed since the last update. In a complex GUI this can be notably faster. Most of the books I've seen recommend not using update() as it can cause race conditions but I have no experience of that - because I use update_idle_tasks! :-) Ok, now I'm using update_idletasks() too (update_idle_tasks() doesn't exist) and I like it. Thanks a lot! ... where would you put the automatic move call, if not where I did? I need an automatic move be performed at the proper moment, when it's the computer player turn. Create the auto move in an event handler of its own and associate with an event. Then raise that event when your players move is finished. Tkinter will then call the automove for you, updating the screeen automatically. In an event driven environment control is passed around by means of events. I prefer not to make this project fully event driven, because while it's fairly easy to translate a mouse click into the game coordinates of the hex that's being clicked, I don't like translating a pair of integers to some point (maybe the center) of an hexagon, creating an Event structure, raising that Event and handling it, just to figure out...the same couple of integers I started with. No, I prefer not to create fake Events when there's none involved... at least in this little game. I'll remember your advice for some serious project! How do you raise an event in Tkinter? Use the event_generate() method. And this would have been my next question, thanks for mind-reading! Alternatively use the after() method with a short delay - say 10ms... That's what I actually did. It plays like a charm! THANK YOU! HTH, SID! Francesco ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Video card test
Which module can I use to do a script for testing video card -- Криле имат само тия, дето дето сърцето им иска да лети ! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Video card test
On Fri, 9 Jul 2010 06:20:13 pm Григор wrote: Which module can I use to do a script for testing video card Tell us how you want to test the video card. -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 77, Issue 25
tutor-requ...@python.org wrote: Send Tutor mailing list submissions to tutor@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/tutor or, via email, send a message with subject or body 'help' to tutor-requ...@python.org You can reach the person managing the list at tutor-ow...@python.org When replying, please edit your Subject line so it is more specific than Re: Contents of Tutor digest... Today's Topics: 1. Re: Having a return when subprocess.Popen finishes (Nick Raptis) 2. Re: Having a return when subprocess.Popen finishes (Payal) 3. Re: Django Read (Huy Ton That) 4. Re: differences between mmap and StringIO (Christopher King) 5. Re: Tkinter mainloop() (Francesco Loffredo) -- Message: 1 Date: Thu, 08 Jul 2010 16:33:02 +0300 From: Nick Raptis airsc...@otenet.gr To: tutor@python.org Subject: Re: [Tutor] Having a return when subprocess.Popen finishes Message-ID: 4c35d38e.4090...@otenet.gr Content-Type: text/plain; charset=ISO-8859-1; format=flowed subprocess.Popen is a class, and as such it returns an object which can do a lot of stuff besides just reading the output. What you want to do here is using it's communicate() method as such: output, errors = ping.communicate() Also, there is a quicker way, I think from version 2.7 forward: use the shortcut output = subprocess.check_output(your command here) Always check latest documentation for your python version too http://docs.python.org/library/subprocess.html Nick On 07/08/2010 04:04 PM, Paul VanGundy wrote: Hi All, I'm trying to get data from subprocess.Popen. To be specific, I am trying to read a ping echo and take the output and assign it to a variable like below: ping = subprocess.Popen(ping -c 5 %s % (server), stdout=subprocess.PIPE, shell=True) However, when I run the command the output that gets assigned to my ping variable is something along the lines of 'subprocess.Popen object at 0x9524bec' and am not returned to prompt. I know that is the proper output but I need to be able to capture the ping replies and assign those to a variable. I tried adding a \r and \n at the end of my cmd. Any help would be greatly appreciated. I'm open to improvements, different ways of doing it and corrections. :) If more info is needed let me know. Thanks. /paul ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Message: 2 Date: Thu, 8 Jul 2010 06:39:51 -0700 From: Payal payal-pyt...@scriptkitchen.com To: tutor@python.org Subject: Re: [Tutor] Having a return when subprocess.Popen finishes Message-ID: 20100708133951.ga4...@scriptkitchen.com Content-Type: text/plain; charset=us-ascii On Thu, Jul 08, 2010 at 09:04:54AM -0400, Paul VanGundy wrote: Hi All, I'm trying to get data from subprocess.Popen. To be specific, I am trying to read a ping echo and take the output and assign it to a variable like below: ping = subprocess.Popen(ping -c 5 %s % (server), stdout=subprocess.PIPE, shell=True) import subprocess server = 'localhost' ping = subprocess.Popen(ping -c 5 %s % (server),stdout=subprocess.PIPE, shell=True) ping.communicate() ('PING localhost (127.0.0.1) 56(84) bytes of data.\n64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.044 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.046 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.052 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.046 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.049 ms\n\n--- localhost ping statistics ---\n5 packets transmitted, 5 received, 0% packet loss, time 3997ms\nrtt min/avg/max/mdev = 0.044/0.047/0.052/0.006 ms\n', None) hth, With warm regards, -Payal -- -- Message: 3 Date: Thu, 8 Jul 2010 10:19:38 -0400 From: Huy Ton That huyslo...@gmail.com To: Jeff Johnson j...@dcsoftware.com Cc: tutor@python.org Subject: Re: [Tutor] Django Read Message-ID: aanlktik4qwufimjc3-gr4y4wx36pkhuiayjbpt-lm...@mail.gmail.com Content-Type: text/plain; charset=iso-8859-1 I've went through the djangobook myself, and found it quite readable. This would be my recommendation as well. Be sure to read the sidebar comments; if you ever feel stuck, someone else may have addressed the question/answer for you! -Lee On Thu, Jul 8, 2010 at 9:31 AM, Jeff Johnson j...@dcsoftware.com wrote: On 07/08/2010 06:06 AM, Nick Raptis wrote: There actually aren't that many books on django around yet which is a pity. You should definitely read The django book: http://www.djangobook.com/en/2.0/ either on the online version on that link, or it's printed counterpart (yes, it's really the same book):
Re: [Tutor] Tutor Digest, Vol 77, Issue 25
tutor-requ...@python.org wrote: Send Tutor mailing list submissions to tutor@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/tutor or, via email, send a message with subject or body 'help' to tutor-requ...@python.org You can reach the person managing the list at tutor-ow...@python.org When replying, please edit your Subject line so it is more specific than Re: Contents of Tutor digest... Today's Topics: 1. Re: Having a return when subprocess.Popen finishes (Nick Raptis) 2. Re: Having a return when subprocess.Popen finishes (Payal) 3. Re: Django Read (Huy Ton That) 4. Re: differences between mmap and StringIO (Christopher King) 5. Re: Tkinter mainloop() (Francesco Loffredo) -- Message: 1 Date: Thu, 08 Jul 2010 16:33:02 +0300 From: Nick Raptis airsc...@otenet.gr To: tutor@python.org Subject: Re: [Tutor] Having a return when subprocess.Popen finishes Message-ID: 4c35d38e.4090...@otenet.gr Content-Type: text/plain; charset=ISO-8859-1; format=flowed subprocess.Popen is a class, and as such it returns an object which can do a lot of stuff besides just reading the output. What you want to do here is using it's communicate() method as such: output, errors = ping.communicate() Also, there is a quicker way, I think from version 2.7 forward: use the shortcut output = subprocess.check_output(your command here) Always check latest documentation for your python version too http://docs.python.org/library/subprocess.html Nick On 07/08/2010 04:04 PM, Paul VanGundy wrote: Hi All, I'm trying to get data from subprocess.Popen. To be specific, I am trying to read a ping echo and take the output and assign it to a variable like below: ping = subprocess.Popen(ping -c 5 %s % (server), stdout=subprocess.PIPE, shell=True) However, when I run the command the output that gets assigned to my ping variable is something along the lines of 'subprocess.Popen object at 0x9524bec' and am not returned to prompt. I know that is the proper output but I need to be able to capture the ping replies and assign those to a variable. I tried adding a \r and \n at the end of my cmd. Any help would be greatly appreciated. I'm open to improvements, different ways of doing it and corrections. :) If more info is needed let me know. Thanks. /paul ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Message: 2 Date: Thu, 8 Jul 2010 06:39:51 -0700 From: Payal payal-pyt...@scriptkitchen.com To: tutor@python.org Subject: Re: [Tutor] Having a return when subprocess.Popen finishes Message-ID: 20100708133951.ga4...@scriptkitchen.com Content-Type: text/plain; charset=us-ascii On Thu, Jul 08, 2010 at 09:04:54AM -0400, Paul VanGundy wrote: Hi All, I'm trying to get data from subprocess.Popen. To be specific, I am trying to read a ping echo and take the output and assign it to a variable like below: ping = subprocess.Popen(ping -c 5 %s % (server), stdout=subprocess.PIPE, shell=True) import subprocess server = 'localhost' ping = subprocess.Popen(ping -c 5 %s % (server),stdout=subprocess.PIPE, shell=True) ping.communicate() ('PING localhost (127.0.0.1) 56(84) bytes of data.\n64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.044 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.046 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.052 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.046 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.049 ms\n\n--- localhost ping statistics ---\n5 packets transmitted, 5 received, 0% packet loss, time 3997ms\nrtt min/avg/max/mdev = 0.044/0.047/0.052/0.006 ms\n', None) hth, With warm regards, -Payal -- -- Message: 3 Date: Thu, 8 Jul 2010 10:19:38 -0400 From: Huy Ton That huyslo...@gmail.com To: Jeff Johnson j...@dcsoftware.com Cc: tutor@python.org Subject: Re: [Tutor] Django Read Message-ID: aanlktik4qwufimjc3-gr4y4wx36pkhuiayjbpt-lm...@mail.gmail.com Content-Type: text/plain; charset=iso-8859-1 I've went through the djangobook myself, and found it quite readable. This would be my recommendation as well. Be sure to read the sidebar comments; if you ever feel stuck, someone else may have addressed the question/answer for you! -Lee On Thu, Jul 8, 2010 at 9:31 AM, Jeff Johnson j...@dcsoftware.com wrote: On 07/08/2010 06:06 AM, Nick Raptis wrote: There actually aren't that many books on django around yet which is a pity. You should definitely read The django book: http://www.djangobook.com/en/2.0/ either on the online version on that link, or it's printed counterpart (yes, it's really the same book):
Re: [Tutor] Tutor Digest, Vol 77, Issue 25
We received 2 copies of the tutor digest from you. If you intentionally sent it - why? Please do not do that again. If you have a specific question or comment - change the subject to something more meaningful - delete everything from the digest that is not related to your question. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor