Python

Started by
9 comments, last by Luctus 15 years, 9 months ago
Hi it's me Vel, i wasn't sure where to post this since there isn't a python section so i was wandering if anyone may know the reason to why everytime i try to run the actual display window (not the shell but the window that you load inside the shell) it crashes. Regards Vel
Advertisement
Eh? This is an incredibly vague question. If you want actual help, you need to give us real details.
errmmm there isn't a error code i can give or anything but if for example i made a new black window and changed its size using the python script and went to execute the script, the new window would crash well just not work.
I suggest posting code.

Python itself knows nothing about windows and their size, so you'll have to be more specific. Are you using a GUI library inside Python?

Am I right in interpreting "crash well just not work" as "the window closes"?
[size="1"]
Are you running Python from the command line? Or are you using IDLE or some other IDE?
i am using the GUI library and the code i am using is off a tutorial heres the code though well the bit that i can get so far before it opens the pygame window that crashes

>>> import sys, pygame
>>> pygame.init()
(6, 0)

this tells it where to import the files from right?

>>> size = width, height = 320, 240
>>> speed = [2, 2]
>>> black = 0, 0, 0

this sets the height and width of the window along with the speed it will move at?
>>>
>>> screen = pygame.display.set_mode(size)
>>>

this brings up the window?

im just want to check at the same time that i understand what i'm writing

Regards Vel
sorry another question how do i get python to find a saved image i have the code but i don't know where to save the picture in order for it to find it

(sorry edit i just didn't specify the place where the picture was sorry)
Your code worked fine for me in IDLE. However, closing the window crashed IDLE. This is a known "issue" with IDLE and Pygame: The pygame screen does not exit correctly in IDLE. Is that the crash you're referring to?

I'd recommend saving your code to a text file with a .py extension and running it with the python interpreter. If you're using Windows, simply double-click on your .py file to run it.

For your second question, Python file operations are relative to the current directory, which is usually the directory where your script is located.
ooo yer that is the error i get and it resets the entire script so that you have to begin from the beginning.

Thanks for the help
Vel
Hey I also have question. I was wondering after you save your program as .py can you send it to a friend? I am not sure that someone without python can open a .py file, so how can others try a program?

This topic is closed to new replies.

Advertisement