[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame graphics window Freezes



Kris Schnee schrieb:
Hi
I tryed what you suggested but the pygame window will stay black. I'm on windowXP and dont know if on other platform this is different. I think, it would be usefull, if one had a console inside the pygame window so one could play around with visual stuff (like drawing lines, loading a image and moving it arround or anything of interesset). I think it could be usefull for debugging and developement. How could this be done?


~DR0ID

Did the pixel not show up at all? Did you make sure it wan't just hard to see, eg. by drawing four right next to each other in white?


Are you using IDLE? If so, you should be able to Alt-Tab between the graphics window and the console window, which lets you send commands that way.

If you wanted to do a console within the graphics window, you'd need to display the text that the user is typing. Bear in mind that "rending" the text is slow, so it'd be best to store the rendered text somewhere and only re-render when the text that should be displayed has changed.

Kris


Hi
I tryed this in IDLE:

IDLE 1.1.1 >>> import pygame
>>> pygame.init()
(6, 0)
>>> screen = pygame.display.set_mode((800,600))
>>> pygame.draw.line(screen, (255,255,255),(0,0),(100,100))
<rect(0, 0, 101, 101)>
>>> pygame.display.update()
>>> for i in range(100):
pygame.display.update()


>>> screen.set_at((50,50),(255,255,255))
>>> pygame.display.update()
>>> pygame.quit()
>>>


But nothing happend in the pygame window.


To build a console within the pygame window, I know I have to render the text. It's not too slow to render the text if its not a lot text. Anyway thats not my question. I do not know how to build a console within the pygame window. Ok, when the problems of displaying and capturing the text have been solved, what must I do with the strings I get from the "inputbox"? I read something about the eval( ) or the exec( ) functions in the docs but do not understand if they are the functions to pass the strings. The idea is, that on could od the same things as in IDLE console (or as similar as possible). Ok there can be some problems. But such a console would be an interactive interface and the user could do everything (from loading images and display them to apply some transfomation or do whatever with the images). I supose it is possible some how, or not?





~DR0ID