Pygame error video system not initialized что делать
Python-сообщество
Уведомления
#1 Апрель 13, 2016 16:17:47
video system not initialized
video system not initialized
Pygame нет, но попробуй вот так код поправить :
Отредактировано Lestoroer (Апрель 13, 2016 16:30:15)
#3 Апрель 13, 2016 16:26:20
video system not initialized
Traceback (most recent call last):
File “
”, line 2, in
for event in pygame.event.get():
pygame.error: video system not initialized
не знаю как отступы сделать.. Полная ошибка выглядит так..
Отредактировано kapaky (Апрель 13, 2016 16:27:20)
#4 Апрель 13, 2016 16:30:43
video system not initialized
”, line 2, in for event in pygame.event.get():pygame.error: video system not initializedне знаю как отступы сделать.. Полная ошибка выглядит так..
#5 Апрель 13, 2016 16:43:41
video system not initialized
pygame.display.set_caption(‘My Game’)
screen.fill(WHITE)
если вобще убрать эти строчки, та же ошибка
#6 Апрель 13, 2016 17:55:11
video system not initialized
все перепробовал, даже от имени администратора запускал. Та же ошибка.
мне кажется что, когда я скачивал “pygame” он был не полный. Если такое бывает.?
#7 Апрель 16, 2016 10:26:50
video system not initialized
может после, когда сам во всем разберусь, то объясню, почему именно так. Но пока работает следующая схема.
pygame.error: video system not initialized, when threading is used [duplicate]
Recently i completed learning about threading in python and now trying to implement it in a program. And here is the code:
Now the problem is that after creating thread i ran into a problem. When i tried to run code it get executed without any problem but when the code exit(i.e., when i close the pygame window) i get to see the error as follows:
1 Answer 1
Ok, so first of all it seems like you are trying to create separate functions with infinite loops for updating the screen and for event handling, to clear the same, all of it can be done in one loop and is perhaps better way of doing the same.[Thus I have removed the exit_app and the update_display function since they use two other infinite while loops.]
Secondly there is no need to use a separate thread for event handling, since the event handling can be done in the same loop, when you create a separate thread for it with an infinite while loop, then that results in confusion as to which thread pygame shall run on, the main thread or the THREAD1.[Thus the same has been commented out.]
Also placing pygame.init function call and all other statements that were before outside inside the if name == ‘main’ block seems to ensure that they are executed. Also placing them before the thread starts makes sure that they are executed and that pygame stuff is initialized before the thread executes.
Instead of the sleep function from the time module, a similar function of the pygame time module namely the pygame.time.delay function can be used, its present within pygame and thus is more suitable to use.
I have experienced many errors while quitting the pygame programs using the inbuilt exit and quit functions, and thus seem to prefer using exit function of the sys module of python since it leads to less errors in most cases.
‘pygame.error: video system not initialized’
My first game, more precisely, its initial appearance (without especially beautiful icons, avatars, backgrounds and objects), was almost ready, and started perfectly, until I wanted to add a start menu, in which it would be possible to change the game parameters and, in fact, launch its button ‘Start’. However, after a few changes to make the menu appear, it turned out that I had some kind of problems with int game () and a black screen. I deleted the previously made changes and tried to start the game without a menu, which it originally was, but the black screen still followed me, and i saw this thing:
Tired of looking for answers on foreign and local forums, I decided to contact the inhabitants of stackover. I really hope for your help. Here, in fact, is the code itself (which I compressed as much as I could):
By the way, I’m not sure I have saw all the questions on the forums and the answers I could, so I might have missed some solution. So, I do not deny that my question may be similar to the others on this site, do not consider it a copy-paste or flood.
1 Answer 1
This entire part can be changed
You can make a lot of changes to your code
Not the answer you’re looking for? Browse other questions tagged python python-3.x pygame or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.11.26.40833
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.