我需要帮助才能将图像显示为默认背景。到目前为止,我已经将背景设置为一种颜色,粉红色。
from guizero import App, Text, Drawing, PushButton, Box, TextBox, Picture from random import randint from ground_object import GroundObject fromfalling_object import FallingObject from timer import Timer, TimerApp
类游戏模拟:
def __init__(self, app):
app.title = 'Avoid Falling Meteor'
app.width = 500
app.height = 500
box = Box(app, layout = 'grid', width= 500, height= 500)
#app.when_key_pressed = key_event_handler
self.drawing = Drawing(box, width= 500, height= 450, grid=[0, 0, 6, 1])
self.fo_list = []
self.app = app
app.when_key_pressed = self.key_event_handler
picture = Picture(app, image = 'images/space.png')
# Build a cover background color
self.drawing.rectangle(0, 0, self.drawing.width, self.drawing.height,
color = 'pink')