Re: [pygame] Keyboards, other questions
On Fri, Oct 9, 2009 at 6:33 PM, pierrelafran...@sympatico.ca wrote: Hi If I have a Linux base application, with 2 USB keyboards connected to it, is it possible to know, when a key is press, from wich keyboard the command is from ? You could investigate whether they show up as separate HID devices in the /dev directory. If so, you should be able to open them and read events from them individually. I don't think you'll be able to distinguish them if you get all your events through the standard pygame event queue, though. -- Greg
[pygame] draw.line bounding box bug when width>1
Hello, New to the list. I have a bug! Nice 'n' easy repro steps below. The bounding box returned by draw.line is the wrong size when width>1. For single occurrence: import pygame pygame.init( ) print pygame.version.ver s= pygame.Surface( ( 20, 20 ) ) rec= pygame.draw.line( s, ( 255,0,0 ), ( 10, 16 ), ( 7, 0 ), 2 ) s.fill( ( 0, 0, 0 ), rec ) print s.get_at( ( 7, 0 ) ) Since the rectangle returned by 'draw' was filled with 0, 'get_at' should return 0. It doesn't. It returns green. I am using WinXP with 1.9.1release-svn2575 and Python2.5. Repro code with random coordinates below: import random as ran import numpy as num s.fill( ( 0, 0, 0 ) ) while 1: x1= ran.randint( 0, 20 ) x2= ran.randint( 0, 20 ) y1= ran.randint( 0, 20 ) y2= ran.randint( 0, 20 ) wid= ran.randint( 1, 2 ) rec= pygame.draw.line( s, ( 255,0,0 ), ( x1, y1 ), ( x2, y2 ), wid ) sorig= pygame.surfarray.array2d( s ) s.fill( ( 0, 0, 0 ), rec ) sa= pygame.surfarray.pixels2d( s ) if num.any( sa ): assert wid> 1 print x1, y1, x2, y2, wid for x, y in zip( *sa.nonzero( ) ): print x, y, s.get_at( ( x, y ) ) sa[ x, y ]= 2 print num.where( sorig, 1, 0 ) s.fill( 1, rec ) print sa print s.fill( ( 0, 0, 0 ) ) Observe that 'wid' is always>1, so the return is correct when wid=1. When 'sa' is printed, it contains '1' throughout the area of the bounding box that 'draw.line' returns. It contains '2' where the pixels of the draw command placed the line.
Re: [pygame] Python IDE for windoz
Opps...hmmm. Forgot I I use this function to test the main: def TestErrors(function): try: function() except Exception, e: tb = sys.exc_info()[2] traceback.print_exception(e.__class__, e, tb) pygame.quit() raw_input() sys.exit() However, it sometimes has troubles recognizing changes after F5/run/quit, then F5/run. Also, tabs/spaces are all spaces... Ian
Re: [pygame] Python IDE for windoz
Hmm, It doesn't lock up for me - window stays if you don't call pygame.quit - but that's it On Sat, Oct 10, 2009 at 2:44 PM, Ian Mallett wrote: > On Sat, Oct 10, 2009 at 12:14 PM, Patrick Mullen wrote: > >> The main reason I don't use IDLE is because I have had issues in the >> past with it's runner locking things up. > > A fair point. It seems to have a problem with PyGame--running PyGame code > with F5 locks it up on exit, or if there's a bug. I keep the directory with > the files in it open (which is good anyway) and just run the relevant code > with a double click. >
Re: [pygame] Python IDE for windoz
On Sat, Oct 10, 2009 at 12:14 PM, Patrick Mullen wrote: > The main reason I don't use IDLE is because I have had issues in the > past with it's runner locking things up. A fair point. It seems to have a problem with PyGame--running PyGame code with F5 locks it up on exit, or if there's a bug. I keep the directory with the files in it open (which is good anyway) and just run the relevant code with a double click.
Re: [pygame] Python IDE for windoz
The main reason I don't use IDLE is because I have had issues in the past with it's runner locking things up. Also editing more than one file at a time is a bit painful. I switched to SciTE for non-ide programming after about 2 years of using IDLE and never looked back. That said, IDLE is more competent than it is often given credit for. I definitely agree with you about some IDE features being overkill and slowing things down instead of speeding them up. On Sat, Oct 10, 2009 at 11:49 AM, Ian Mallett wrote: > I came to the conclusion that IDEs are designed to make your life easier by > pinpointing bugs, adding breakpoints, compiling nicely, etc. I use IDLE > because it doesn't have any of that--it's just a compiler and a > text-editor. I don't have trouble; I think not having spiffy features > encourages one to write better code in the first place. >
Re: [pygame] Python IDE for windoz
I came to the conclusion that IDEs are designed to make your life easier by pinpointing bugs, adding breakpoints, compiling nicely, etc. I use IDLE because it doesn't have any of that--it's just a compiler and a text-editor. I don't have trouble; I think not having spiffy features encourages one to write better code in the first place.
Re: [pygame] Python IDE for windoz
Most? people just don't like it - personally it's all I use, Windows or otherwise... On Sat, Oct 10, 2009 at 12:23 PM, Kris Schnee wrote: > What's wrong with the built-in editor, IDLE? >
Re: [pygame] Python IDE for windoz
What's wrong with the built-in editor, IDLE?
Re: [pygame] Python IDE for windoz
For Windows: Pyscripter http://www.mmm-experts.com/Products.aspx?ProductId=4 Gumm On Tue, Oct 6, 2009 at 5:04 PM, pierrelafran...@sympatico.ca < pierrelafran...@sympatico.ca> wrote: > Hi > I have administrator rights on a computor in a lab at work, until > tomorrow. I would like install IDE for Python. What do you suggest me ? > > I know, I may not write this question in the good room, but I just learn > this news, and after tomorrow, it will be too late to install Python. > > Thanks > -- > Pierre >
Re: [pygame] Depth Screenshot
On Tue, Oct 6, 2009 at 7:50 PM, RB[0] wrote: > I would suggest PIL - don't have the exact functions for it off the top of > my head though... I considered that. I'm trying to avoid PIL, though. On Wed, Oct 7, 2009 at 12:24 AM, René Dudfield wrote: > something like: > red = rgb_im[:,:,0:1] > surf_red = pygame.image.fromstring(red, size, 'P') > pygame.image.save(surf_red, "red.png") > Not sure how this works, but it looks like the right track. data = glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE)returns a string, so red = rgb_im[:,:,0:1] doesn't work. Ian