pygame is
Simple DirectMedia Layer is
Site Swing

pygame-console - 0.5

John Schanck (jmschanck)



pygame-console provides a console similar to the one found in games such as Quake 3, which can be imbedded into any pygame application.


This version adds a lot of new functionality. You can now select between the pyconsole interpreter which was previously available (which has lots of new features too). Or a full fledged python interpreter. I've fixed a whole bunch of bugs, and made it all a bit easier to use (at least in my opinion). The Pyconsole interpreter now supports variable assignment (using the form $name = value), and now you can get and pass variables to and from the console. Having the python interpreter available is a huge step and we're nearing completion -- at least feature wise. I'll try to improve the documentation some time soon, but for now if you have any questions my email address is in the Readme. -John


Home Page:


click to view original size


pygame-console - 0.7 - Dec 2, 2006
pygame-console - 0.5 - Sep 13, 2006
pygame-console - 0.2 - Aug 17, 2006
pygame-console - 0.1 - Aug 11, 2006 account Comments

If you wish to leave a comment with your account, please sign in first.

December 23, 2010 11:02pm - Robert Leachman - nickname: (quazar) - 5/5
I used this in Produce Defend Win and it's great (I mean your lib, my game was just fun)
November 24, 2009 6:07pm - Marco Baxemyr - nickname: (phelerox) - 5/5
Very nice! Thanks!
August 22, 2009 6:41pm - Chris Weisiger - nickname: (derakon)
Hey, thanks for writing this! I made some changes to integrate it into my project and make turning the console on and off easier. Among other things this made the preserve_events option pointless, but that's fine. I thought I'd include the diff just so you can see what I did:

< font_path = os.path.join(path, "fonts")
> font_path = os.path.join(path, 'data', 'fonts')
< self.font = pygame.font.Font(os.path.join(font_path,"default.ttf"), 14)
> self.font = pygame.font.Font(os.path.join(font_path,"MODENINE.TTF"), 14)
< def process_input(self):
> def process_input(self, eventlist):
< if not
< return;
< if self.preserve_events:
< eventlist = pygame.event.get(KEYDOWN)
< else:
< eventlist = pygame.event.get()
< if event.type == KEYDOWN:
> if event.type == KEYUP and event.key == K_BACKQUOTE:
> self.set_active()
> return
> elif and event.type == KEYDOWN and event.key != K_BACKQUOTE:
October 31, 2006 9:02am - David Eyk - nickname: (eykd) - 4/5
Looks interesting, but that bit of os.chdir magic at the beginning clobbers the path when I import it. I need to be able to find my config files too. :) (It's an easy fix if you just store the absolute path in a variable and use that throughout.)

Also, the test script in the download (and now pyconsole itself) is failing on a division by zero error, line 133 in __init__:

self.max_lines = (self.size[HEIGHT] / self.font_height) - 1

The font height isn't being set correctly?
October 18, 2006 10:24am - captp - nickname: (bdcht) - 3/5
Nice work.
Still, I had to redefine c_shiftmap for european keyboards and change
key range from (32,127) to (32,256)... hum, I guess this should be handled more
properly inside Console (my hack is baaaaaad). Maybe have a look at the pyconsole (uses pygtk) which does not have this "problem".
September 16, 2006 5:04pm - Christopher Smith - nickname: (maximinus)
Thumbs up to the author for quick feedback. Hopefully there'll be some more development on this. At the moment it's merely very good, whereas it could well become excellent!
September 14, 2006 4:54pm - John Schanck - nickname: (jmschanck)
Chris I sent you an email detailing why this is happening, but for anyone else that experiences this, the problem is that the event queue is filling up because you're not handling things like mouse events. Just set preserve_events to False in pyconsole.cfg, or change your code to handle the other events.

The font included is Bitstream Vera Sans Mono which is released under a free license.
September 14, 2006 5:44am - Christopher Smith - nickname: (maximinus) - 4/5
Nice and easy to put in a project - very nice code. However, when I place it in my code, it hangs after 47 characters have been input.
Also, what is the license on the font included?
August 31, 2006 7:11pm - Jerry Heiselman - nickname: (jheiselman)
Great! How can I find out when a the new release is ready?
August 25, 2006 3:07pm - John Schanck - nickname: (jmschanck)
Ok I worked on the performance a bit and now the framerate drop is pretty insignificant (the drop is the same as if you were just blitting anything the size of the console to the screen). I'll make a new release soon.
August 24, 2006 1:18pm - Jerry Heiselman - nickname: (jheiselman)
The anonymous posts on Aug-23 and today at 8:21 AM are by me. I thought this site would set a cookie, but it does not. Anyway, I'll remember to login before posting anymore.
August 24, 2006 8:21am - Anonymous - nickname: () - 5/5
Here is the code that is using pyconsole. The pyconsole code itself has only been modified in that we removed the Ctrl-D to exit the game and changed the Ctrl-W to Ctrl-~.
August 23, 2006 1:20pm - Anonymous - nickname: ()
Thanks for the positive response. There really shouldn't be a drop in framerate at all when the console isn't being displayed. That's because both Console.process_input() and Console.draw() check to make sure the console is active before doing anything. Is there any way I can take a look at your code?
August 23, 2006 10:49am - Anonymous - nickname: () - 4/5
Great implementation. Seems very useful, however, I've noticed that with the console code in my game, my FPS drops significantly, even without the console being displayed! Is there a reason for that? Perhaps I'm implementing it wrong or something.
August 17, 2006 5:56pm - John Schanck - nickname: (jmschanck) - 5/5
Sorry about that Michael, I had accidentally included a font which I had been using for testing, the license of which I was unsure of. To be safe I took the file down, but it's back up now and I'd love for you or anyone else to try it out and give me some feedback.
August 16, 2006 3:36am - Michael Brunton-Spall - nickname: (mibgames) - 1/5
No files on sourceforge and no code in the CVS. If I cant get this, I cant try it

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Oct 21, 2014

Oct 20, 2014

Oct 16, 2014

Oct 9, 2014

Oct 8, 2014

Oct 7, 2014

Oct 4, 2014

Oct 1, 2014

Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)