MIP.watch('count', function (newVal, oldVal) { fetch('http://www.chazidian.com/kaoshi/ajaxapi/?action=guanzhu&id=30943&type=2') .then(function (res) { var follows2 = MIP.getData('follows') if(follows2==1){ MIP.setData({ follows:2, title:'收藏' }) } if(follows2==2){ console.log(2) MIP.setData({ follows:1, title:'已收藏' }) } }) .catch(function (err) { console.log('数据请求失败!') }) })

请用 Python 语言编写一个简易的计算器程序。

查看答案
正确答案:

from tkinter import *

reset=True

def buttonCallBack(event):

global label

global reset

num=event.widget['text']

if num=='C':

label['text']="0"

return

if num in "=":

label['text']=str(eval(label['text']))

reset=True

return

s=label['text']

if s=='0' or reset==True:

s=""

reset=False

label['text']=s+num #主窗口

root=Tk() root.wm_title(" 计算器 ") #显示栏 1 label=Label(root,text="0",background="white",anchor="e")

label['width']=35

label['height']=2

label.grid(row=1,columnspan=4,sticky=W) #按钮

showText="789/456*123-0.C+"

for i in range(4):

for j in range(4):

b=Button(root,text=showText[i*4+j],width=7)

b.grid(row=i+2,column=j)

b.bind("",buttonCallBack) showText="()"

for i in range(2):www.jb51.net

b=Button(root,text=showText[i],width=7)

b.grid(row=6,column=2+i)

b.bind("",buttonCallBack) b=Button(root,text="=")

b.grid(row=6,columnspan=2,sticky="we")

b.bind("",buttonCallBack)

root.mainloop()

答案解析:

暂无解析

上一题
你可能感兴趣的试题

软件开发离不开系统环境资源的支持,其中必要的测试数据属于

A、辅助资源
B、硬件资源
C、通信资源
D、支持软件

请举例说明Python面向对象的多态性(例如函数重载、运算符重载)是如何实现的?

以下程序的输出结果是:

ls=list({'shandong':200,'hebei':300,'beijing':400})

print(ls)

A、['300','200','400']
B、['shandong','hebei','beijing']
C、[300,200,400]
D、'shandong','hebei','beijing'

以下对数值运算操作符描述错误的选项是:

A、Python提供了9个基本的数值运算操作符
B、Python数值运算操作符也叫做内置操作符
C、Python二元数学操作符都有与之对应的增强赋值操作符
D、Python数值运算操作符需要引用第三方库math

下列有关数据库的描述,正确的是

A、数据库是一个关系
B、数据库是一个DBF文件
C、数据库是一个结构化的数据集合
D、数据库是一组文件
热门试题 更多>
相关题库更多>
公共基础
Python语言程序设计
MS Office高级应用
Web程序设计
MySQL数据库程序设计