python提示keyerror 13372_Python wx 模块,EVT_SPINCTRL 实例源码 - 编程字典

def InitUI(self):

#

on_hour = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_on"].split(":")[0])

on_min = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_on"].split(":")[1])

off_hour = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_off"].split(":")[0])

off_min = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_off"].split(":")[1])

# draw the pannel and text

pnl = wx.Panel(self)

wx.StaticText(self, label='Lamp Config;', pos=(20, 10))

# hour on - first line

wx.StaticText(self, label='on time', pos=(10, 50))

self.on_hour_spin = wx.SpinCtrl(self, min=0, max=23, value=str(on_hour), pos=(80, 35), size=(60, 50))

self.on_hour_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)

wx.StaticText(self, label=':', pos=(145, 50))

self.on_min_spin = wx.SpinCtrl(self, min=0, max=59, value=str(on_min), pos=(155, 35), size=(60, 50))

self.on_min_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)

# length on on period - second line

wx.StaticText(self, label='Lamp on for ', pos=(25, 100))

self.on_period_h_spin = wx.SpinCtrl(self, min=0, max=23, value="", pos=(130, 85), size=(60, 50))

self.on_period_h_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)

wx.StaticText(self, label='hours and ', pos=(195, 100))

self.on_period_m_spin = wx.SpinCtrl(self, min=0, max=59, value="", pos=(280, 85), size=(60, 50))

self.on_period_m_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)

wx.StaticText(self, label='min', pos=(345, 100))

# off time - third line (worked out by above or manual input)

wx.StaticText(self, label='off time', pos=(10, 150))

self.off_hour_spin = wx.SpinCtrl(self, min=0, max=23, value=str(off_hour), pos=(80, 135), size=(60, 50))

self.off_hour_spin.Bind(wx.EVT_SPINCTRL, self.off_spun)

wx.StaticText(self, label=':', pos=(145, 150))

self.off_min_spin = wx.SpinCtrl(self, min=0, max=59, value=str(off_min), pos=(155, 135), size=(60, 50))

self.off_min_spin.Bind(wx.EVT_SPINCTRL, self.off_spun)

# cron timing of switches

wx.StaticText(self, label='Cron Timing of Switches;', pos=(10, 250))

wx.StaticText(self, label='Current New', pos=(50, 280))

lamp_on_string = MainApp.config_ctrl_pannel.get_cron_time("lamp_on.py").strip()

lamp_off_string = MainApp.config_ctrl_pannel.get_cron_time("lamp_off.py").strip()

wx.StaticText(self, label=" on;", pos=(20, 310))

wx.StaticText(self, label="off;", pos=(20, 340))

self.cron_lamp_on = wx.StaticText(self, label=lamp_on_string, pos=(60, 310))

self.cron_lamp_off = wx.StaticText(self, label=lamp_off_string, pos=(60, 340))

new_on_string = (str(on_min) + " " + str(on_hour) + " * * *")

new_off_string = (str(off_min) + " " + str(off_hour) + " * * *")

self.new_on_string_text = wx.StaticText(self, label=new_on_string, pos=(220, 310))

self.new_off_string_text = wx.StaticText(self, label=new_off_string, pos=(220, 340))

# set lamp period values

on_period_hour, on_period_min = self.calc_light_period(on_hour, on_min, off_hour, off_min)

self.on_period_h_spin.SetValue(on_period_hour)

self.on_period_m_spin.SetValue(on_period_min)

#ok and cancel buttons

self.ok_btn = wx.Button(self, label='Ok', pos=(15, 450), size=(175, 30))

self.ok_btn.Bind(wx.EVT_BUTTON, self.ok_click)

self.cancel_btn = wx.Button(self, label='Cancel', pos=(315, 450), size=(175, 30))

self.cancel_btn.Bind(wx.EVT_BUTTON, self.cancel_click)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值