AttributeError:模块“cfg”没有属性“SCREENSIZE”[重复]

问题描述 投票:0回答:1

我用python写了一个游戏使用的cfg模块。但是运行程序时出现错误。错误是“AttributeError: module 'cfg' has no attribute 'SCREENSIZE'”

不知道怎么解决这个问题

python attributeerror cfg
1个回答
-1
投票
import os
import sys
import pygame
import cfg
from modules import *
 
 
'''main'''
def main():
    pygame.init()
    screen = pygame.display.set_mode(cfg.SCREENSIZE) #this row is problem
    pygame.display.set_caption('Gemgem —— love')
    pygame.mixer.init()
    pygame.mixer.music.load(os.path.join(cfg.ROOTDIR, "resources/audios/bg.mp3"))
    pygame.mixer.music.set_volume(0.6)
    pygame.mixer.music.play(-1)
© www.soinside.com 2019 - 2024. All rights reserved.