0
私はボタンを取るwxPythonのパネルを持っています。enable monitor
クリックして、以下のループを開始してください。またGUIを解放し、ボタンラベルをdisable monitor
に更新します。 disable
をクリックすると、ループが完全に停止します。GUIのルーピング
私はthreading
を見ましたが、私はこの場合に何をすべきかはわかりません。
ループ全体がdef startStop(self)
宣言内で実行され、wxPanelのclass
内で実行されます。
私は頭がおかしくなっていますが、私はこのGUIをしばらくは試してきましたが、正しい方法でこのレッスンを完成させたいと思います。 :)
擬似コード:
while zonesToMonitor != []:
time.sleep(int(self.tc_CheckInterval.Value))
j = 0
for i in zonesToMonitor:
maxVOL = maxVolPerZone[j]
urllib.urlopen("http://" + ip_address + ":" + self.tc_serverPort.Value +"/data/rendererData?data=R::" + wx.FindWindowByLabel(i).Label).read()
INFO = urllib.urlopen("http://" + ip_address + ":" + self.tc_serverPort.Value +"/data/rendererAction?data=class").read()
curTime = datetime.datetime.now()
curTime = curTime.strftime("%H:%M")
if self.ck_QuietHours.Value == True:
quietStartHr = self.tc_quietHr.Value
quietEndHr = self.tc_quietHrStop.Value
quietVol = self.tc_QuietVol.Value
if (curTime > quietStartHr) and (curTime < quietEndHr):
print "In quiet hours..."
maxVOL = quietVol
if self.ck_MuteHours.Value == True:
muteStartHr = self.tc_MuteHr.Value
muteEndHr = self.tc_MuteHrStop.Value
if (curTime > muteStartHr) and (curTime < muteEndHr):
print "In mute time..."
maxVOL = 0
OUTPUT = re.findall('(?<=VOLUME::).*?(?=_\|_)', INFO)
if maxVOL == '':
maxVOL = 0
if OUTPUT == '':
OUTPUT = 0
OUTPUT = map(int, OUTPUT)
if OUTPUT > int(maxVOL):
url = "http://" + ip_address + ":" + self.tc_serverPort.Value + "/data/rendererAction?data=VOLUME::" + str(maxVOL)
urllib.urlopen(url).read()
j += 1
うわー - ありがとう - 私は最終的に、FINALLY、インターネットからのサンプルコードをリッピングの数え切れないほどの時間後にこの作業を行う方法を理解します。それを簡単に保つためにありがとう。 :) – chow