您的位置:首页 > 编程语言 > Python开发

Python_week#4_quiz4b_question9

2016-06-27 08:05 267 查看
 

import simplegui

a = 5

# Handler for keydown

def keydown(key):

    global a 

    ####### Addd KEY_MAP to translate to key codes

    if key == simplegui.KEY_MAP["up"]:

        a = a+a

 

def keyup(key):

    global a 

     

    if key == simplegui.KEY_MAP["up"]:

        a = a -3

    print a 

frame = simplegui.create_frame('Testing', 100, 100)

 

frame.set_keydown_handler(keydown)

frame.set_keyup_handler(keyup)

# Start the frame animation

frame.start()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python