Py学习  »  Python

TypeError:“module”对象在Python 3中不可调用

DeBeast591 • 5 年前 • 155 次点击  

pygame.rect() 但当我运行它时,它每次都会给我这个错误或类似的错误。

# Imports
import pygame

pygame.init()

# class
class Shape:
    def __init__(self, width, height, color):
        self.width = width
        self.height = height
        self.color = color
        self.SHAPE = pygame.rect(self, width, height, color)

# RunApp() function
def runApp(width, height):
    screen = pygame.display.set_mode((width, height))
    done = False

    while not done:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                done = True

        pygame.display.flip()

测试.py( import main 将更改为 import pyseed.main

# PySeed Testing Zone
import main as pyseed

myShape = pyseed.Shape(90, 90, (0, 100, 255))

pyseed.runApp(400, 300)

谢谢你的帮助。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54641
 
155 次点击  
文章 [ 1 ]  |  最新文章 5 年前