def Button_4_onCommand(uiName, widgetName): UrlText = Fun.GetText(uiName, "Entry_3") Webbrowser_5 = Fun.GetElement(uiName, 'Webbrowser_5') Webbrowser_5.set_URL(UrlText) Button_7 = Fun.GetElement(uiName, 'Button_7') Button_7.configure(state="normal") Button_8 = Fun.GetElement(uiName, 'Button_8') Button_8.configure(state="disable")
def Configure(self, event): if self.root == event.widget: Text_2 = Fun.GetElement(self.__class__.__name__, 'Text_2') Text_2_Scrollbar = Fun.GetElement(self.__class__.__name__, 'Text_2_Scrollbar') Text_2.place(x=0, y=0, width=event.width, height=event.height) Text_2_Scrollbar.place(x=event.width - 20, y=0, width=20, height=event.height)
def Button_6_onCommand(uiName, widgetName): QueryID = Fun.GetText(uiName, 'Entry_5') Express = Fun.GetElement(uiName, 'Express_9') ListBox = Fun.GetElement(uiName, 'ListBox_7') isThread = Fun.GetTKVariable(uiName, "CheckButton_10") print(isThread) if isThread == True: run_thread = threading.Thread(target=ThreadCount, args=[Express, QueryID, ListBox]) run_thread.start() else: Express.set_ExpressNumber(QueryID) Express.Query(ListBox)
def Configure(self, event): if self.root == event.widget: PanedWindow_8 = Fun.GetElement(self.__class__.__name__, 'PanedWindow_8') Label_9 = Fun.GetElement(self.__class__.__name__, 'Label_9') PanedWindow_8.place(x=0, y=50, width=event.width, height=event.height - 51 - 20) Label_9.place(x=0, y=event.height - 20, width=event.width, height=20)
def Form_1_onLoad(uiName): pass pass pass pass pass Fun.SetText(uiName, "Entry_3", "http://www.baidu.com") Webbrowser_5 = Fun.GetElement(uiName, 'Webbrowser_5') Entry_3_Variable = Fun.G_UIElementVariableArray[uiName]['Entry_3'] Webbrowser_5.setURLEntryVariable(Entry_3_Variable) Button_7 = Fun.GetElement(uiName, 'Button_7') Button_7.configure(state="disable") Button_8 = Fun.GetElement(uiName, 'Button_8') Button_8.configure(state="disable")
def Button_8_onCommand(uiName, widgetName): Webbrowser_5 = Fun.GetElement(uiName, 'Webbrowser_5') Webbrowser_5.goForward() if Webbrowser_5.cangoBack() == False: Button_7 = Fun.GetElement(uiName, 'Button_7') Button_7.configure(state="disable") else: Button_7 = Fun.GetElement(uiName, 'Button_7') Button_7.configure(state="normal") if Webbrowser_5.cangoForward() == False: Button_8 = Fun.GetElement(uiName, 'Button_8') Button_8.configure(state="disable") else: Button_8 = Fun.GetElement(uiName, 'Button_8') Button_8.configure(state="normal")
def Configure(self, event): if self.root == event.widget: Frame_2 = Fun.GetElement(self.__class__.__name__, 'Frame_2') Frame_2.place(x=0, y=30, width=event.width, height=event.height - 30) Webbrowser_5 = Fun.GetElement(self.__class__.__name__, 'Webbrowser_5') Webbrowser_5.resetSize(event.width, event.height - 30) Entry_3 = Fun.GetElement(self.__class__.__name__, 'Entry_3') Entry_3.place(x=157, y=7, width=event.width - 270, height=20) Entry_3.focus_force() Button_4 = Fun.GetElement(self.__class__.__name__, 'Button_4') Button_4.place(x=event.width - 110, y=7, width=100, height=20)
def Button_7_onCommand(uiName, widgetName): #root=Fun.GetElement(uiName,"root") #root.destroy() isOk = CSelectServerManger.stopService() if (isOk): listBox = Fun.GetElement(uiName, "ListBox_8") listBox.insert(tkinter.END, "Server has been stopped!")
def Button_11_onCommand(uiName, widgetName): name = Fun.GetText(uiName, 'Entry_3') gender = Fun.GetTKVariable(uiName, 'Group_1') if gender == 1: gender = '男' else: gender = '女' age = Fun.GetText(uiName, 'Entry_8') combobox = Fun.GetElement(uiName, 'ComboBox_10') address = combobox.get() treeview = Fun.GetElement('TabPage1', 'TreeView_2') treeview.insert('', 'end', values=(name, gender, age, address)) Fun.SetText(uiName, 'Entry_3', '') Fun.SetTKVariable(uiName, 'Group_1', 1) Fun.SetText(uiName, 'Entry_8', 0) combobox.current(0)
def deleteSelected(uiName, TreeViewName): treeview = Fun.GetElement(uiName, TreeViewName) index = treeview.selection() if (len(index) == 0): return None item = treeview.item(index) treeview.delete(index) return item['values']
def editSelected(uiName, TreeViewName, *item): treeview = Fun.GetElement(uiName, TreeViewName) index = treeview.selection() if (len(index) == 0): return None treeview.set(index, '用户账号', item[0]) treeview.set(index, '密码', item[1]) return treeview.item(index)['values']
def Button_6_onCommand(uiName,widgetName): global threadAction targetUrl = Fun.GetText(uiName,"Entry_3") total = Fun.GetText(uiName,"Entry_5") Text_2 = Fun.GetElement("RightTextBar","Text_2") Text_2.delete('0.0',tkinter.END) threadAction = True run_thread = threading.Thread(target=run, args=[targetUrl,uiName,0,int(total)]) run_thread.start()
def TreeView_2_onButton1(event, uiName, widgetName): TreeCtrl = Fun.GetElement(uiName, widgetName) item = TreeCtrl.identify("item", event.x, event.y) if item is not None and item is not "": filename_lower = str(item).lower() if filename_lower.find(".png") >= 0 or filename_lower.find( ".jpg") >= 0: img = Image.open(filename_lower) img.show()
def Button_2_onCommand(uiName, widgetName): listBox = Fun.GetElement(uiName, "ListBox_3") listBox8 = Fun.GetElement(uiName, "ListBox_8") listBox.delete(0, "end") listBox8.delete(0, "end") filepath = tkinter.filedialog.askdirectory(initialdir=os.path.abspath('.'), title='打开目录查找') #Fun.SetText(uiName, "Entry_11", dirPath) global DirPath DirPath = filepath pdf_fileName = getFileName(filepath) if (not pdf_fileName): Fun.MessageBox("没有发现pdf文件!") return #listBox = Fun.GetElement(uiName,"ListBox_3") for item in pdf_fileName: file = item.replace(filepath, "").replace("\\", "") listBox.insert(tkinter.END, file)
def Button_9_onCommand(className, widgetName): start = Fun.GetText(className, "Entry_3") to = Fun.GetText(className, "Entry_5") date = Fun.GetText(className, "Entry_8") listBox = Fun.GetElement(className, "ListBox_10") ticket = Ticket() ticket.set_FromStation(start) ticket.set_ToStation(to) ticket.set_TicketDate(date) ticket.curlData(listBox)
def Button_8_onCommand(uiName, widgetName): userId = Fun.GetText(uiName, 'Entry_5') passWd = Fun.GetText(uiName, 'Entry_6') txt = Fun.GetText('add', 'Button_8') if (txt == "修改"): item = GridBase.editSelected('DbList', 'TreeView_12', userId, passWd) DbBase.editAccountInfo(item[2], userId, passWd) else: id = DbBase.addAccountInfo(userId, passWd) GridBase.addItem('DbList', 'TreeView_12', userId, passWd, id) root = Fun.GetElement(uiName, 'root') root.destroy()
def Button_4_onCommand(uiName,widgetName): StockCode = Fun.GetText(uiName,"Entry_3") StockInfo = StockMonitor.getStockInfo(StockCode) StockCode = StockInfo[u'code'] StockName = StockInfo[u'name'] StockTime = StockInfo[u'time'] StockPrice = StockInfo[u'price'] MaxPrice = Fun.GetText(uiName,"Entry_10") MinPrice =Fun.GetText(uiName,"Entry_12") TreeView13 = Fun.GetElement(uiName,"TreeView_13") TreeView13 .insert('','end',values=(StockCode[0],StockName[0],StockTime[0],StockPrice[0],MinPrice,MaxPrice)) StockArray = Fun.GetUserData(uiName,"TreeView_13","StockArray") StockArray.append([StockCode[0],MaxPrice,MinPrice])
def Button_11_onCommand(uiName, widgetName): savePath = tkinter.filedialog.asksaveasfilename( initialdir=os.path.abspath('.'), title='Save Python File', filetypes=[('Python File', '*.py'), ('All files', '*')]) if (savePath == "" or len(savePath) <= 0): Fun.MessageBox("请输入合并后的文件名!") return listBox8 = Fun.GetElement(uiName, "ListBox_8") count = listBox8.size() if (count < 2): Fun.MessageBox("至少要选择两个文件进行合并!") return MergePDF(DirPath, openPath, listBox8)
def run(targetUrl, uiName,beginNUM, endNUM): global threadAction urlPath, webName = os.path.split(targetUrl) Text_2 = Fun.GetElement('RightTextBar','Text_2') if threadAction == False: output = 'Stop' Text_2.insert(tkinter.END,output) return req = urllib.request.Request(url=targetUrl, headers=header) response = urllib.request.urlopen(req) html = response.read().decode('gb2312', 'ignore') soup = BeautifulSoup(html, 'html.parser') Divs = soup.find_all('div', attrs={'id': 'big-pic'}) nowpage = soup.find('span', attrs={'class': 'nowpage'}).get_text() totalpage = soup.find('span', attrs={'class': 'totalpage'}).get_text() if beginNUM == endNUM: return for div in Divs: beginNUM = beginNUM + 1 if div.find('a') is None: print('No Images') return elif div.find('a')['href'] is None or div.find('a')['href'] == "": print('No Images') return labelText = '>>>:Progress :' + str(beginNUM) + '/' + str(endNUM) + ' ,DownLoading Images:('+ str(nowpage) + '/' + str(totalpage) + ')' Fun.SetText(uiName,'Label_9',labelText) if int(nowpage) < int(totalpage): nextPageLink = urlPath + '//' + (div.find('a')['href']) elif int(nowpage) == int(totalpage): nextPageLink = (div.find('a')['href']) picLink = (div.find('a').find('img')['src']) picAlt = (div.find('a').find('img'))['alt'] output = 'Image Link:'+ picLink + '\n' Text_2.insert(tkinter.END,output) output = 'DirName:[ '+ picAlt + ' ] ' + '\n' Text_2.insert(tkinter.END,output) output = 'Start...........\n' Text_2.insert(tkinter.END,output) Download(picLink, picAlt, nowpage) output = 'Finish!\n' Text_2.insert(tkinter.END,output) output = 'Next link:'+nextPageLink + '\n' Text_2.insert(tkinter.END,output) Text_2.see(tkinter.END) run(nextPageLink, uiName , beginNUM, endNUM) return
def Button_6_onCommand(uiName,widgetName): global StockMonitorInst BtnText = Fun.GetText(uiName,widgetName) if BtnText == "启动监控": if StockMonitorInst == None: StockMonitorInst = StockMonitor.StockMonitor() StockArray = Fun.GetUserData(uiName,"TreeView_13","StockArray") for stockcode in StockArray: StockMonitorInst.addStock(stockcode[0],stockcode[1],stockcode[2]) TreeView = Fun.GetElement(uiName,"TreeView_13") PhoneNumber=Fun.GetText(uiName,"Entry_17") StockMonitorInst.SetMonitorInfo(TreeView,PhoneNumber) StockMonitorInst.StartMonitoring() Fun.SetText(uiName,widgetName,"停止监控") else: StockMonitorInst.StopMonitoring() Fun.SetText(uiName,widgetName,"启动监控")
def Download(url, picAlt, name): global G_UITreeImageArray global G_UITreeItemArray newPath = os.getcwd() + "\\images\\"+ picAlt + "\\" fullPath = '{0}{1}.jpg'.format(newPath, name) imageName = '{0}.jpg'.format(name) if url.find(".png") >= 0 : fullPath = '{0}{1}.png'.format(newPath, name) imageName = '{0}.png'.format(name) TreeView_2 = Fun.GetElement('LeftTreeBar','TreeView_2') parentItem = '' if not os.path.exists(newPath): os.makedirs(newPath) parentItem = TreeView_2.insert('','end',newPath,text=picAlt,values=('1'),tags = ('dirs',)) G_UITreeItemArray[picAlt] = parentItem else: if picAlt in G_UITreeItemArray: parentItem = G_UITreeItemArray[picAlt] else: parentItem = TreeView_2.insert('','end',newPath,text=picAlt,values=('1'),tags = ('dirs',)) G_UITreeItemArray[picAlt] = parentItem newTreeItem = TreeView_2.insert(parentItem,'end',fullPath,text=imageName,values=('2')) urllib.request.urlretrieve(url, fullPath)
def Button_5_onCommand(uiName, widgetName): listBox = Fun.GetElement(uiName, "ListBox_3") listBox8 = Fun.GetElement(uiName, "ListBox_8") moveAllItem(listBox, listBox8)
def Button_6_onCommand(uiName, widgetName): listBox = Fun.GetElement(uiName, "ListBox_3") listBox8 = Fun.GetElement(uiName, "ListBox_8") moveSelectedItem(listBox8, listBox)
def __dealReceiveMsg(self, msg): listBox = Fun.GetElement("Chat", "ListBox_9") listBox.insert(tkinter.END, msg)
def Button_10_onCommand(uiName, widgetName): Webbrowser_5 = Fun.GetElement(uiName, 'Webbrowser_5') Webbrowser_5.gohome()
def Button_9_onCommand(uiName, widgetName): Webbrowser_5 = Fun.GetElement(uiName, 'Webbrowser_5') Webbrowser_5.refresh()
def getSelected(uiName, TreeViewName): treeview = Fun.GetElement(uiName, TreeViewName) index = treeview.selection() if (len(index) == 0): return None return treeview.item(index)['values']
def clearData(uiName, TreeViewName): treeview = Fun.GetElement(uiName, TreeViewName) obj = treeview.get_children() for i in obj: treeview.delete(i) return treeview
def Configure(self, event): if self.root == event.widget: TreeView_2 = Fun.GetElement(self.__class__.__name__, 'TreeView_2') TreeView_2.place(x=0, y=0, width=event.width, height=event.height)
def addItem(uiName, TreeViewName, *item): treeview = Fun.GetElement(uiName, TreeViewName) treeview.insert('', 'end', values=(item[0], item[1], item[2]))