创建显示区域 显示部分创建一个矩形和一个文本框 def __createDisplay(self): bg = Rectangle(Point(.5,5.5), Point(5.5,6.5)) bg.setFill(white) bg.draw(self.win) text = Text(Point(3,6), ) text.draw(self.win) text.setFace(courier) text.setStyle(bold) text.setSize(16) self.display = text 交互部分 设计一个run函数完成所有的交互 Run函数反复执行下列动作: 等待用户按下按钮 根据选择的按钮执行不同的操作 def run(self): while 1: key = self.getKeyPress() cessKey(key) getKeyPress 等待mouse click事件 判断点击了哪一个按钮 def getKeyPress(self): while 1: p = self.win.getMouse()
原创力文档

文档评论(0)