def _resolve_keywords_results(self, other): try: test = self._load_test_from_datasource() except IOError, error: msg = 'Could not check correct model from data source!\n%s' tkMessageBox('Loading Data Source Failed', msg % (error)) return
def izlistaj_iz_baze(podaci_iz_baze): global prozor global izlistaj if "prozor" in globals(): prozor.destroy() prozor = Frame() prozor.configure(background="gray93") prozor.pack(fill="both", expand=True) imena_stupaca = ("id", "poveznica", "ocjena") izlistaj = ttk.Treeview(height = "30",columns = imena_stupaca,\ show = "headings", selectmode="extended") ysb = ttk.Scrollbar(orient='vertical', command=izlistaj.yview) xsb = ttk.Scrollbar(orient='horizontal', command=izlistaj.xview) izlistaj['yscroll'] = ysb.set izlistaj['xscroll'] = xsb.set izlistaj.column("id", width=100, stretch=NO) izlistaj.heading("id", text="ID") izlistaj.column("poveznica", width=450, stretch=YES) izlistaj.heading("poveznica", text="Poveznice") izlistaj.column("ocjena", width=50, stretch=NO) izlistaj.heading("ocjena", text="Ocjena") ysb.grid(in_=prozor, row=0, column=1, sticky=NS) xsb.grid(in_=prozor, row=1, column=0, sticky=EW) prozor.rowconfigure(0, weight=1) prozor.columnconfigure(0, weight=1) izlistaj.grid(column=0, row=0, in_=prozor) for i in range(0, len(podaci_iz_baze)): izlistaj.insert("", i, iid = i,\ values = (podaci_iz_baze[i][0], podaci_iz_baze[i][1], podaci_iz_baze[i][2])) izlistaj.bind("<Double-1>", dohvat_txt_baza) if len(podaci_iz_baze) < 1: tkMessageBox(" ", "U bazi nema zapisa koji odgovaraju pretragi")
def show_file_content(): global txt_path filepath = txt_path.get( 1.0, Tkinter.END).strip() #strip() is required to remove newline from end print "Filepath : " + filepath import os if os.path.exists(filepath): if os.path.isfile(filepath): try: f = open(filepath, "r") l = f.readlines() print l content = ''.join(l) tkMessageBox.showinfo("Content of " + filepath, content) except: tkMessageBox("Error", "Error while reading file.") finally: f.close() else: tkMessageBox.showinfo( "Error", "You only need to specify the full path of file") else: tkMessageBox.showerror( "Error", "This is not a valid path or path does not exist.")
def proceed_to_download_file(self, button, filename): file = self.download_file(filename) if file != None: #books = get_books_table() insertRows('books', (None, file, filename, get_serialNumber()), 1) button.configure(text="Already owned", command=None) else: tkMessageBox("Error", "Error downloading file!")
def update_image(self,root,image_label, cam): (readsuccessful, f) = self.cam.read() if readsuccessful: self.current_frame = cv2.cvtColor(f, cv2.COLOR_BGR2RGB) a = Image.fromarray(self.current_frame) b = ImageTk.PhotoImage(image=a) image_label.configure(image=b) image_label._image_cache = b # avoid garbage collection root.update() else: tkMessageBox("Camera Not Connected")
def revoke(): """Revokes Submitted Identity""" try: res = check_output("export FABRIC_CA_CLIENT_HOME=" + dir + "; fabric-ca-client revoke -e " + t13.get() + ";", shell=True) print(res) except Exception as e: error(str(e)) tkMessageBox("Info", "Successfully Revoked")
def opendir(self): self.textbox.delete('1.0',END) self.dirname = tkFileDialog.askdirectory() self.entryvar.set(self.dirname) showmessage = 'just for tip' if not self.dirname: self.messagebox=tkMessageBox(self.showframe,Message=showmessage) self.dirlist=os.listdir(self.entryvar.get()) for eachdir in self.dirlist: self.textbox.insert(END,eachdir+'\r\n') self.textbox.update()
class ManualTest(robotapi.RunnableTestCase, AbstractManualTestOrKeyword): def __init__(self, test, parent, from_xml=False): AbstractManualModel.__init__(self, test, parent) if from_xml: self.starttime = self._get_valid_time(test.starttime) self.endtime = self._get_valid_time(test.endtime) self.message = test.message or "" else: self.message = self._get_default_message() self.longname = test.longname self.setup = self._get_setup_keyword(test, from_xml) self.teardown = self._get_teardown_keyword(test, from_xml) self.tags = robotapi.normalize_tags(test.tags) self.keywords = [ ManualKeyword(kw, self, from_xml) for kw in test.keywords ] self.critical = test.critical self.timeout = test.timeout self.compare_attrs = ['status', 'message', 'tags'] def _mark_data_modified(self, executed=True): AbstractManualModel._mark_data_modified(self) if executed: self._add_tags_added_to_modified_tests(mark_modified=False) def _add_tags_added_to_modified_tests(self, mark_modified): self.add_tags(SETTINGS["tags_added_to_modified_tests"], mark_modified=mark_modified) def _get_items(self): return self.keywords def _get_default_message(self): return SETTINGS["default_message"] def add_results(self, other, add_from_xml, override_method): same_keywords = self._has_same_keywords(other) if self._load_other(other, override_method) and same_keywords: self._add_info_from_other(other) if same_keywords: self._add_keywords_results(other, add_from_xml, override_method) elif add_from_xml: self._resolve_keywords_results(other) else: self._mark_data_modified(executed=False) def _add_info_from_other(self, other): AbstractManualTestOrKeyword._add_info_from_other(self, other) self._add_loaded_tags(other) def _resolve_keywords_results(self, other): try: test = self._load_test_from_datasource() except IOError, error: msg = 'Could not check correct model from data source!\n%s' tkMessageBox('Loading Data Source Failed', msg % (error)) return if not test or test._has_same_keywords(self): return if test._has_same_keywords(other): test = other else: msg = "Keywords of test '%s' were updated from the data source.\n" msg += "Therefore changes made to those keywords could not be saved.\n" tkMessageBox('Keywords Reloaded', msg % (self.longname)) self._add_info_from_other(test) self._copy_keywords(test) self._mark_data_modified(executed=False)
def Universidad(): try: os.system("iceweasel http://www.udistrital.edu.co/ &") except: os.system("midori http://www.udistrital.edu.co/ &") tkMessageBox(bicho, text="Tal vez pueda ir a la siguiente paguinax http://www.udistrital.edu.co/ desde su navegador de internet")
def getCouponlist(oldWindow, mobileNum, bottleCount): #### Get All Available Coupon For the Specified Value global optionSelect backPointer = None couponVal = {} oldWindow.destroy() master5 = tk.Toplevel() ws5 = master5.winfo_screenwidth() # width of the screen hs5 = master5.winfo_screenheight() # height of the screen if optionSelect == 1: coverPhoto = Image.open(imagesEnglish + "Screen10/" + "Background.jpg") imgConfirm = Image.open(imagesEnglish + "Screen10/" + "confirm.jpg") else: coverPhoto = Image.open(imagesHindi + "Screen10/" + "Background.jpg") imgConfirm = Image.open(imagesHindi + "Screen10/" + "confirm.jpg") coverPhoto = coverPhoto.resize((ws5, hs5), PIL.Image.ANTIALIAS) coverPhoto = ImageTk.PhotoImage(coverPhoto) lbl5Background = Label(master5, width=ws5, height=hs5, image=coverPhoto) lbl5Background.photo = coverPhoto lbl5Background.pack(fill=BOTH, expand=YES) master5.config(width=ws5, height=hs5) couponList = [] for (dirpath, dirnames, filenames) in walk(imgCoupon): couponList.extend(filenames) if len(couponList) == 0: tkMessageBox( "Info", "No Coupons Available at the moment.. Please try after Sometime") return lblCoupon = Label(lbl5Background, width=250, height=2, font=('Times', 18, 'bold'), fg="Black", bg="white", text="Select Coupon") lblCoupon.place(x=50, y=50) couponButtons = [ ['cp1', 'cp2', 'cp3', 'cp4'], ['cp5', 'cp6', 'cp7', 'cp8'], ] r = 0 c = 0 xPad = 0 yPad = 0 lblXpad = 0 lblYpad = 0 for i in range(0, len(couponList)): rImg = Image.open(imgCoupon + couponList[i]) newImg = ImageTk.PhotoImage(rImg) cycleButton = tk.Button(lbl5Background, highlightthickness=0, bd=0, image=newImg) cycleButton.config(width=100, height=100, command=partial(sendCoupon, couponButtons[r][c], mobileNum, master5)) cycleButton.image = newImg cycleButton.place(x=50 + xPad, y=200 + yPad) lblInfo = Label(lbl5Background, text=couponDetails[i]["LabelText"], font=('Times', 15, 'bold'), height=1, bg="white", fg="#040459", highlightthickness=0, bd=0) lblInfo.place(x=25 + lblXpad, y=350 + lblYpad) if i == 4 or i == 8: r += 1 yPad += 200 lblYpad += 200 xPad = 0 else: xPad += 200 lblXpad += 200 c += 1 imgConfirm = ImageTk.PhotoImage(imgConfirm) confirmButton = tk.Button(lbl5Background, highlightthickness=0, bd=0, image=imgConfirm, command=lambda: restartRecycling(master5)) confirmButton.image = imgConfirm confirmButton.place(x=775, y=550) master5.attributes("-fullscreen", True) master5.mainloop()