I have installed pygame and livewires but am getting the following error with the following short program that I got from my python book.

AttributeError: 'module' object has no attribute 'init'

# New Graphics Window
# Demonstrates creating a graphics window

from livewires import games

games.init(screen_width = 640, screen_height = 480, fps = 50)

games.Screen.mainloop()

Recommended Answers

All 5 Replies

I have installed pygame and livewires but am getting the following error with the following short program that I got from my python book.

AttributeError: 'module' object has no attribute 'init'

# New Graphics Window
# Demonstrates creating a graphics window

from livewires import games

games.init(screen_width = 640, screen_height = 480, fps = 50)

games.Screen.mainloop()

I believe 'games.int' would only be used if you created that in a class, though never using livewires before, I believe the following code would work.

g = games(screen_width = 640, screen_height = 480, fps = 50)

Then just reuse the 'g', or any other chosen variable.

LiveWires is a pretty well dated Python course that uses a module called games as a wrapper for PyGame. It is supposed to make the use of PyGame easier for the beginner.

Looking over the module games.py, there is no init() method, unless there is a much newer version out.

LiveWires is a pretty well dated Python course that uses a module called games as a wrapper for PyGame. It is supposed to make the use of PyGame easier for the beginner.

Looking over the module games.py, there is no init() method, unless there is a much newer version out.

I wonder why my book "Python Programming 2nd Ed. for the absolute beginner" gave me that program. This is frustrating.

What is the publication date of the book? Perhaps it is an old book.

I suggest you simply use the module pygame directly, tell us what you want to do and show some effort, the rest of us will help. Many of us are familiar with pygame, but not with the old somewhat mind numbing livewires pygame wrapper.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.