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.

pygame error video system not initialized что делать. Смотреть фото pygame error video system not initialized что делать. Смотреть картинку pygame error video system not initialized что делать. Картинка про pygame error video system not initialized что делать. Фото pygame error video system not initialized что делать

pygame error video system not initialized что делать. Смотреть фото pygame error video system not initialized что делать. Смотреть картинку pygame error video system not initialized что делать. Картинка про pygame error video system not initialized что делать. Фото pygame error video system not initialized что делать

1 Answer 1

This entire part can be changed

You can make a lot of changes to your code

pygame error video system not initialized что делать. Смотреть фото pygame error video system not initialized что делать. Смотреть картинку pygame error video system not initialized что делать. Картинка про pygame error video system not initialized что делать. Фото pygame error video system not initialized что делать

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.12.22.41046

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

pygame.error: видеосистема не инициализирована python кодовая ошибка

После запуска этого кода я получил сообщение об ошибке:

Может ли кто-нибудь помочь мне и объяснить, что означает эта ошибка и как ее исправить?

2 ответа

Вот код, который я пытаюсь запустить через ssh в свой raspberry pi. Обычно он отлично работает, когда у меня есть клавиатура и монитор, подключенные непосредственно к raspberry pi, но он не работает, когда я использую ssh. import pygame, sys, time from pygame.locals import * pygame.init().

Я только что добавил немного музыки в свою игру pygame, но я думаю, что код настолько запутан, что ничего не находится в нужном месте. В результате этого добавления я теперь получаю эту ошибку: Обратная трассировка (самый недавний призыв последнего): файл.

поместите свой код:

до while заявления`

Похожие вопросы:

поэтому я получаю эту ошибку, когда пытаюсь запустить свой код pygame: pygame.error: видеосистема не инициализирована я указываю, где крыло IDE говорит мне, что оно находится в коде ниже import os.

Я смотрел и смотрел. Каждый раз, когда я нахожу этот вопрос заданным, человеку говорят позвонить pygame.init() Когда спрашивающий говорит, что они сделали это, ответов больше нет. Я перепробовал.

У меня есть две проблемы с моей программой: Когда я закрываю свою программу, она имеет ошибку: keys = pygame.key.get_pressed() pygame.error: video system not initialized Квадрат перемещается, когда.

Вот код, который я пытаюсь запустить через ssh в свой raspberry pi. Обычно он отлично работает, когда у меня есть клавиатура и монитор, подключенные непосредственно к raspberry pi, но он не.

Я только что добавил немного музыки в свою игру pygame, но я думаю, что код настолько запутан, что ничего не находится в нужном месте. В результате этого добавления я теперь получаю эту ошибку.

У меня есть простой текстовый код печати pygame. Когда он запускается, он открывает окно pygame, а затем выходит из строя. Я несколько раз проверял, не пропустил ли я чего-нибудь, но не могу найти.

Я получаю эту ошибку, когда пытаюсь запустить свой код pygame pygame.error: видеосистема не инициализирована. Я использую Repl.it и пытаюсь создать прицельную игру, которая может отслеживать.

В настоящее время я следую учебнику python по книге и наконец-то пришел к созданию pygame. После ручного ввода каждого кода, Игра (Инопланетное Вторжение) import sys import pygame from settings.

Источник

video system not initialized

When I run the following code I get an error. Most of the other similar posts talks about pygame.quit() sys.exit() which I have, but still see the error

pygame error video system not initialized что делать. Смотреть фото pygame error video system not initialized что делать. Смотреть картинку pygame error video system not initialized что делать. Картинка про pygame error video system not initialized что делать. Фото pygame error video system not initialized что делать

2 Answers 2

pygame.quit() should be out of the loop:

Otherwise after the first iteration of the loop, pygame.quit() would have been called and on the second iteration the error would have occured.

pygame error video system not initialized что делать. Смотреть фото pygame error video system not initialized что делать. Смотреть картинку pygame error video system not initialized что делать. Картинка про pygame error video system not initialized что делать. Фото pygame error video system not initialized что делать

You have to care about the Indentation

While pygame.quit() has to be done after the main application loop (as mentioned in another answer and the comments), drawing the scene and the update of the display has to be done in the main application loop rather than the event loop:

Note, the event loop is executed once for each event, but the application loop is executed once for each frame.

pygame error video system not initialized что делать. Смотреть фото pygame error video system not initialized что делать. Смотреть картинку pygame error video system not initialized что делать. Картинка про pygame error video system not initialized что делать. Фото pygame error video system not initialized что делать

Not the answer you’re looking for? Browse other questions tagged python 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.12.22.41046

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *