我有一个问题与我的python,我已经复制和粘贴每件事从树莓派到PC和下载的Visual Studio代码运行它,并下载python和guizero到我的PC通过命令终端,但即使这样,当我运行我的代码,它打开了一个窗口,它约1秒没有加载,然后立即关闭后,有人能帮助,我的代码在这里:
from guizero import App, Combo, Text, CheckBox, ButtonGroup, PushButton, info
def do_booking():
info('Booking', 'Thank you for Booking')
print( film_choice.value )
print( vip_seat.value )
print( row_choice.value )
app = App(title="My second GUI app", width=500, height=200, layout="grid")
film_discription = Text(app, text='Which film do you want to watch?', grid=[0,0], align='left')
film_choice = Combo(app, options=['Star Wars', 'Harry Potter', 'Frozen', 'Lion King'], grid=[1,0], align='left')
vip_seat_discription = Text(app, text='VIP is more comfy and can go down', grid=[0,1], align='left')
vip_seat = CheckBox(app, text='VIP seat?', grid=[1,1], align='left')
row_choice_disciption = Text(app, text='Where do you want to sit?', grid=[0,2], align='left')
row_choice = ButtonGroup(app, options=[ ['Front', 'F'], ['Middle', 'M'], ['Back', 'B'] ], selected='M', horizontal=True, grid=[1,2], align='left')
book_seats = PushButton(app, command=do_booking, text='Book Seat', grid=[1,3], align='left')
app.display
我试过导入一个等待命令并使用它来阻止它关闭,但它只是说没有响应,然后当等待结束时,它关闭
1条答案
按热度按时间oxosxuxt1#
app.display()
:)末尾缺少左右括号