Py学习  »  DeBeast591  »  全部回复
回复总数  1
4 年前
回复了 DeBeast591 创建的主题 » TypeError:“module”对象在Python 3中不可调用

我的新代码:

主.py

# Made by DeBeast591
# Enjoy!

# Imports
import pygame

# Getting PyGame ready...
pygame.init()
print("Welcome to PySeed!\nMade By DeBeast591\nEnjoy!")

def setUp(width, height):
    global screen
    screen = pygame.display.set_mode((width, height))

# class
class Shape:
    def __init__(self, x, y, width, height, color):
        global screen
        self.width = width
        self.height = height
        self.x = x
        self.y = y
        self.color = color
        self.SHAPE = pygame.draw.rect(screen, self.color,pygame.Rect(self.x, self.y, self.width, self.height))

# RunApp() function
def runApp():
    global screen
    done = False

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

        pygame.display.flip()

# PySeed Testing Zone
import main as pyseed

pyseed.setUp(400, 300)

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

pyseed.runApp()

谢谢你的帮助。