① Python编程:三角形计算器
whileTrue:
a,b,c=eval(input('输入三角形三边长,以逗号分隔:'))
ifa+b>canda+c>bandb+c>a:
break;
print('输入的三边长不合法,请重新输入')
print('周长为...')
print('面积为...')
② python璁$畻鍣
python璁$畻鍣ㄥ疄鐜帮細
wx.TextCtrl锛堟枃鏈杈撳叆鎺т欢锛夛紝杩欎釜浣滀负璁$畻鍣ㄧ殑鏄剧ず灞忥紝鐐瑰嚮鏁板瓧鏃剁敤AppendText鏂规硶灏嗘暟瀛楁坊鍔犺嚦鏂囨湰鏈灏撅紝瑕佸彇鍑烘暟瀛楁椂鐢℅etValue鏂规硶锛岀偣鍑昏繍绠楃︽椂瑕佸皢鏂囨湰妗嗕腑鐨勬暟瀛楁竻绌猴紙鍏堝瓨鍌锛夌敤Clear鏂规硶鐒跺悗杩樻湁灏嗘搷浣滅︿繚瀛橈紝鐐瑰嚮绛夊彿鍚庤佸皢绗浜屼釜鎿嶄綔鏁板瓨鍌锛岀劧鍚庣敤int鏂规硶灏嗗瓧绗︿覆杞鎹涓烘暟瀛楋紝璁$畻鍚庣敤SetValue鏂规硶灏嗙粨鏋滈佸叆鏂囨湰妗嗭紝鍏蜂綋浠g爜濡備笅锛
importwx
#beginwxGlade:extracode
#endwxGlade
classMyFrame(wx.Frame):
def__init__(self,*args,**kwds):
#beginwxGlade:MyFrame.__init__
kwds["style"]=wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self,*args,**kwds)
self.text_ctrl_1=wx.TextCtrl(self,-1,"",style=wx.TE_READONLY)
self.button_37=wx.Button(self,-1,"1")
self.button_38=wx.Button(self,-1,"2")
self.button_39=wx.Button(self,-1,"3")
self.button_40=wx.Button(self,-1,"+")
self.button_41=wx.Button(self,-1,"4")
self.button_42=wx.Button(self,-1,"5")
self.button_43=wx.Button(self,-1,"6")
self.button_44=wx.Button(self,-1,"-")
self.button_46=wx.Button(self,-1,"7")
self.button_45=wx.Button(self,-1,"8")
self.button_47=wx.Button(self,-1,"9")
self.button_48=wx.Button(self,-1,"x")
self.button_49=wx.Button(self,-1,"C")
self.button_50=wx.Button(self,-1,"0")
self.button_51=wx.Button(self,-1,"=")
self.button_52=wx.Button(self,-1,"/")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON,self.bu1,self.button_37)
self.Bind(wx.EVT_BUTTON,self.bu2,self.button_38)
self.Bind(wx.EVT_BUTTON,self.bu3,self.button_39)
self.Bind(wx.EVT_BUTTON,self.bu_plus,self.button_40)
self.Bind(wx.EVT_BUTTON,self.bu4,self.button_41)
self.Bind(wx.EVT_BUTTON,self.bu5,self.button_42)
self.Bind(wx.EVT_BUTTON,self.bu6,self.button_43)
self.Bind(wx.EVT_BUTTON,self.bu_min,self.button_44)
self.Bind(wx.EVT_BUTTON,self.bu7,self.button_46)
self.Bind(wx.EVT_BUTTON,self.bu8,self.button_45)
self.Bind(wx.EVT_BUTTON,self.bu9,self.button_47)
self.Bind(wx.EVT_BUTTON,self.bu_mul,self.button_48)
self.Bind(wx.EVT_BUTTON,self.bu_clear,self.button_49)
self.Bind(wx.EVT_BUTTON,self.bu0,self.button_50)
self.Bind(wx.EVT_BUTTON,self.bu_result,self.button_51)
self.Bind(wx.EVT_BUTTON,self.bu_chu,self.button_52)
#endwxGlade
self.Show(True)
def__set_properties(self):
#beginwxGlade:MyFrame.__set_properties
self.SetTitle("PythonCalculaterbyCYG")
self.text_ctrl_1.SetMinSize((400,50))
self.button_37.SetMinSize((100,50))
self.button_38.SetMinSize((100,50))
self.button_39.SetMinSize((100,50))
self.button_40.SetMinSize((100,50))
self.button_41.SetMinSize((100,50))
self.button_42.SetMinSize((100,50))
self.button_43.SetMinSize((100,50))
self.button_44.SetMinSize((100,50))
self.button_46.SetMinSize((100,50))
self.button_45.SetMinSize((100,50))
self.button_47.SetMinSize((100,50))
self.button_48.SetMinSize((100,50))
self.button_49.SetMinSize((100,50))
self.button_50.SetMinSize((100,50))
self.button_51.SetMinSize((100,50))
self.button_52.SetMinSize((100,50))
#endwxGlade
def__do_layout(self):
#beginwxGlade:MyFrame.__do_layout
sizer_2=wx.BoxSizer(wx.VERTICAL)
sizer_3=wx.BoxSizer(wx.VERTICAL)
grid_sizer_1=wx.GridSizer(4,4,0,0)
sizer_3.Add(self.text_ctrl_1,0,0,0)
grid_sizer_1.Add(self.button_37,0,0,0)
grid_sizer_1.Add(self.button_38,0,0,0)
grid_sizer_1.Add(self.button_39,0,0,0)
grid_sizer_1.Add(self.button_40,0,0,0)
grid_sizer_1.Add(self.button_41,0,0,0)
grid_sizer_1.Add(self.button_42,0,0,0)
grid_sizer_1.Add(self.button_43,0,0,0)
grid_sizer_1.Add(self.button_44,0,0,0)
grid_sizer_1.Add(self.button_46,0,0,0)
grid_sizer_1.Add(self.button_45,0,0,0)
grid_sizer_1.Add(self.button_47,0,0,0)
grid_sizer_1.Add(self.button_48,0,0,0)
grid_sizer_1.Add(self.button_49,0,0,0)
grid_sizer_1.Add(self.button_50,0,0,0)
grid_sizer_1.Add(self.button_51,0,0,0)
grid_sizer_1.Add(self.button_52,0,0,0)
sizer_3.Add(grid_sizer_1,1,wx.EXPAND,0)
sizer_2.Add(sizer_3,1,wx.EXPAND,0)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
#endwxGlade
defbu1(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("1")
event.Skip()
defbu2(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("2")
event.Skip()
defbu3(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("3")
event.Skip()
defbu_plus(self,event):#wxGlade:MyFrame.<event_handler>
self.num1=self.text_ctrl_1.GetValue()
self.op="+"
self.text_ctrl_1.Clear()
event.Skip()
defbu4(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("4")
event.Skip()
defbu5(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("5")
event.Skip()
defbu6(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("6")
event.Skip()
defbu_min(self,event):#wxGlade:MyFrame.<event_handler>
self.num1=self.text_ctrl_1.GetValue()
self.op="-"
self.text_ctrl_1.Clear()
event.Skip()
defbu7(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("7")
event.Skip()
defbu8(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("8")
event.Skip()
defbu9(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("9")
event.Skip()
defbu_mul(self,event):#wxGlade:MyFrame.<event_handler>
self.num1=self.text_ctrl_1.GetValue()
self.op="x"
self.text_ctrl_1.Clear()
event.Skip()
defbu_clear(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.Clear()
event.Skip()
defbu0(self,event):#wxGlade:MyFrame.<event_handler>
self.text_ctrl_1.AppendText("0")
event.Skip()
defbu_chu(self,event):#wxGlade:MyFrame.<event_handler>
self.num1=self.text_ctrl_1.GetValue()
self.op="/"
self.text_ctrl_1.Clear()
event.Skip()
defbu_result(self,event):#wxGlade:MyFrame.<event_handler>
self.num2=self.text_ctrl_1.GetValue()
num1=int(self.num1)
num2=int(self.num2)
ifself.op=="+":
self.text_ctrl_1.SetValue(str(num1+num2))
elifself.op=="-":
self.text_ctrl_1.SetValue(str(num1-num2))
elifself.op=="x":
self.text_ctrl_1.SetValue(str(num1*num2))
elifself.op=="/":
self.text_ctrl_1.SetValue(str(num1/num2))
event.Skip()
#endofclassMyFrame
if__name__=="__main__":
app=wx.App(False)
myframe=MyFrame(None)
app.MainLoop()
③ 如何用手机编程Python
手机下载APP
手机分为智能手机(Smart phone) [2] 和非智能手机(Feature phone),一般智能手机的性能比非智能手机要好,但是非智能手机比智能手机性能稳定,大多数非智能手机和智能手机使用英国ARM公司架构的CPU。智能手机的主频较高,运行速度快,处理程序任务更快速,日常更加的方便(例如:诺基亚n81主频有369兆赫兹);而非智能手机的主频则比较低,运行速度也比较慢(例如:诺基亚5000主频就是50兆赫兹)。
智能手机(Smart phone),是指像个人计算机一样,具有独立的操作系统,大多数是大屏机,而且是电容式触摸屏,也有部分是电阻式触摸屏,功能强大实用性高。可以由用户自行安装包括游戏等第三方服务商提供的程序,通过此类程序来不断对手机的功能进行扩充,并可以通过移动通讯网络来实现无线网络接入的这样一类手机的总称”。从广义上说,智能手机除了具备手机的通话功能外,还具备了PDA的大部分功能,特别是个人信息管理以及基于无线数据通信的浏览器和电子邮件功能。智能手机为用户提供了足够的屏幕尺寸和带宽,既方便随身携带,又为软件运行和内容服务提供了广阔的舞台。很多增值业务可以就此展开,如:股票、新闻、天气、交通、商品、应用程序下载、音乐图片,游戏下载等等
手机类型顾名思义就是指手机的外在类型,比较常用的分类是把手机分为直板式、折叠式(单屏、双屏)、滑盖式、旋转式、侧滑式等几类。
要翻开盖才可见到主显示器或按键,且只有一个屏幕,则这种手机被称为单屏翻盖手机。市场上还推出了双屏翻盖手机,即在翻盖上有另一个副显示屏,这个屏幕通常不大,一般能显示时间、信号、电池、来电号码等功能。屏幕比较小,一般在2.2英寸或1.8英寸,处理器较慢。