def Button_3_onCommand(uiName, widgetName): filePath = tkinter.filedialog.askopenfilename( initialdir=os.path.abspath('.'), title='选择文件') Fun.SetText(uiName, "Entry_4", filePath) input = PdfFileReader(open(filePath, "rb")) pageCount = input.getNumPages() Fun.SetText(uiName, "Entry_6", pageCount)
def Button_13_onCommand(uiName, widgetName): item = GridBase.getSelected(uiName, 'TreeView_12') if (item == None): Fun.MessageBox("请先选择数据,在进行修改!") return topLevel = tkinter.Toplevel() topLevel.attributes("-toolwindow", 1) topLevel.wm_attributes("-topmost", 1) import add add.add(topLevel) #设置修改页的值 Fun.SetText('add', 'Entry_5', item[0]) Fun.SetText('add', 'Entry_6', item[1]) Fun.SetText('add', 'Button_8', '修改') tkinter.Tk.wait_window(topLevel)
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 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 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 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 Form_1_onLoad(className): Fun.SetText(className, "Entry_3", "北京") Fun.SetText(className, "Entry_5", "昆明") date = time.strftime("%Y-%m-%d", time.localtime()) Fun.SetText(className, "Entry_8", date)
def clearData(uiName, TreeViewName): treeview = Fun.GetElement(uiName, TreeViewName) obj = treeview.get_children() for i in obj: treeview.delete(i) return treeview ''' def loopData(uiName,TreeViewName): treeview = Fun.GetElement(uiName,TreeViewName) obj = treeview.get_children() for i in obj: item = treeview.item(i) print(item['values']) ''' ''' 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() Fun.SetText(uiName,'Entry_3','') Fun.SetTKVariable(uiName,'Group_1',1) Fun.SetText(uiName,'Entry_8',0) combobox.current(0) '''
def Form_1_onLoad(uiName): Fun.SetText(uiName,'Entry_3','http://www.mmonly.cc/mmtp/qcmn/237273_10.html') Fun.SetText(uiName,'Entry_5','200')
def Form_1_onLoad(uiName): Fun.SetText(uiName, "Entry_8", "10,35,100")
def Button_10_onCommand(uiName,widgetName): dirPath = tkinter.filedialog.askdirectory(initialdir=os.path.abspath('.'), title='打开目录查找') Fun.SetText(uiName, "Entry_11", dirPath)
def Button_5_onCommand(uiName,widgetName): filePath = tkinter.filedialog.askopenfilename(initialdir=os.path.abspath('.'), title='选择文件') Fun.SetText(uiName, "Entry_6", filePath)