GithubHelp home page GithubHelp logo

i keep on getting the following error on this code i found which is using pygame to control a RC car Traceback (most recent call last): line 27, in <module> main() , line 20, in main if getKey('LEFT'): line 9, in getKey for eve in pygame.event.get(): ^^^^^^^^^^^^^^^^^^ pygame.error: video system not initialized >>> about pygame HOT 7 CLOSED

abhi4-5 avatar abhi4-5 commented on June 25, 2024
i keep on getting the following error on this code i found which is using pygame to control a RC car Traceback (most recent call last): line 27, in main() , line 20, in main if getKey('LEFT'): line 9, in getKey for eve in pygame.event.get(): ^^^^^^^^^^^^^^^^^^ pygame.error: video system not initialized >>>

from pygame.

Comments (7)

illume avatar illume commented on June 25, 2024

You need to call your init() function.

from pygame.

abhi4-5 avatar abhi4-5 commented on June 25, 2024

You need to call your init() function.

How do I do that?😂

from pygame.

illume avatar illume commented on June 25, 2024

After this line

if name == 'main':

from pygame.

abhi4-5 avatar abhi4-5 commented on June 25, 2024
if __name__ == '__main__':
    init()
    while True:
        main()

I did this and I'm still getting this error:
line 5, in init
win = pygamedisplay.set_mode((100,100))
^^^^^^^^^^^^^
NameError: name 'pygamedisplay' is not defined

line 26, in
init()

from pygame.

illume avatar illume commented on June 25, 2024

You forgot a .

from pygame.

abhi4-5 avatar abhi4-5 commented on June 25, 2024

i put the .

def init():
    pygame.init()
    win = pygame.display.set_mode((100,100))

but im still getting this error:
line 26, in
init()

line 5, in init
win = pygame.display.set_mode((100,100))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pygame.error: No available displays

Im sorry if the mistake in the code seems obvious im very new to coding

from pygame.

abhi4-5 avatar abhi4-5 commented on June 25, 2024

i have changed different other parts of the code but I am still getting the above error. does anyone know why?

from pygame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.