def checkWin():
    global turn, turnCounter
    if (b1["text"] == b2["text"] == b3["text"] and b1["state"] == b2["state"] == b3["state"] == 'disabled') or \
            (b4["text"] == b5["text"] == b6["text"] and b4["state"] == b5["state"] == b6["state"] == 'disabled') or \
            (b7["text"] == b8["text"] == b9["text"] and b7["state"] == b8["state"] == b9["state"] == 'disabled') or \
            (b1["text"] == b4["text"] == b7["text"] and b1["state"] == b4["state"] == b7["state"] == 'disabled') or \
            (b2["text"] == b5["text"] == b8["text"] and b2["state"] == b5["state"] == b8["state"] == 'disabled') or \
            (b3["text"] == b6["text"] == b9["text"] and b3["state"] == b6["state"] == b9["state"] == 'disabled') or \
            (b1["text"] == b5["text"] == b9["text"] and b1["state"] == b5["state"] == b9["state"] == 'disabled') or \
            (b3["text"] == b5["text"] == b7["text"] and b3["state"] == b5["state"] == b7["state"] == 'disabled'):
        # checks victory conditions, I could have made this shorter with a for loop by keeping the buttons in a list
        if turn:
            choice = tkMessageBox.askquestion("Winner!", "O Won!\nRematch?")
            if choice == 'no':
                tk.quit()
            else:
                resetGrid()
        else:
            choice = tkMessageBox.askquestion("Winner!", "X Won!\nRematch?")
            if choice == 'no':
                tk.quit()
            else:
                resetGrid()

    else:
        if turnCounter == 9:
            choice = tkMessageBox.askquestion("Draw!", "You drew!\nRematch?")
            if choice == 'no':
                tk.quit()
            else:
                resetGrid()
Example #2
0
 def key(self, event):
     print "pressed", repr(event.char)
     if event.char == 's':
     	print 'solving'
     	answer = self.mesa.breadth()
     	#box.showinfo("Information", "Download completed")
     	decisao = box.askquestion(
         "Eight Puzzle",
         "Solução: %s. \n Deseja ver caminhos testados?" % answer
     	)
     	print decisao
     	if decisao == 'yes':
     		box.showinfo(
     		"Eight Puzzle", 
     		"%s" % self.mesa.vector_breadth_used
     		)
     if event.char == 'd':
     	print 'solving'
     	self.mesa.pre_deep()
     	answer = self.mesa.deep()
     	#box.showinfo("Information", "Download completed")
     	decisao = box.askquestion(
         "Eight Puzzle",
         "Solução: %s. \n Deseja ver caminhos testados?" % answer
     	)
     	if decisao == 'yes':
     		box.showinfo(
     		"Eight Puzzle", 
     		"%s" % self.mesa.vector_tried
     		)
Example #3
0
 def p_callback(self, event):
     self.parent.after_cancel( self.after_id )
     tkMessageBox.askquestion(
         title = "Paused!",
         message="Continue?",
         type=tkMessageBox.OK)
     self.after_id = self.parent.after( self.delay, self.move_my_shape )
 def p_callback(self, event):
     self.parent.after_cancel( self.after_id )
     tkMessageBox.askquestion(
         title = "Paused!",
         message="Continue?",
         type=tkMessageBox.OK)
     self.after_id = self.parent.after( self.delay, self.move_my_shape )
Example #5
0
 def valider(self, event=None):
     francais = self.txtFrancais.get().strip().lower()
     etranger = self.txtEtranger.get().strip().lower()
     if francais=="":
         tkMessageBox.showwarning(_(u"Libellé incorrect"), _(u"Veuillez remplir tous les champs de cette boîte de dialogue."))
         self.txtFrancais.focus()
         return
     if etranger=="":
         tkMessageBox.showwarning(_(u"Libellé incorrect"), _(u"Veuillez remplir tous les champs de cette boîte de dialogue."))
         self.txtEtranger.focus()
         return
     (f, e, d) = self.master.master.verifierDoublons(self.langue, self.dico, francais, etranger)
     if d == True:
         tkMessageBox.showwarning(_(u"Doublons détectés"), _(u"Ce couple a déjà été entré. Vous ne pouvez pas faire de doublons."))
         self.txtEtranger.delete(0, len(self.txtEtranger.get()))
         self.txtFrancais.delete(0, len(self.txtFrancais.get()))
         self.txtFrancais.focus()
         return
     if f == True:
         if tkMessageBox.askquestion(_(u"Doublons détectés"), _(u"Le mot %s \"%s\" est déjà dans le dictionnaire. Êtes-vous certain de l'associer à un second mot %s ?") %(application_language, francais, self.langue))=="no":
             self.txtFrancais.delete(0, len(self.txtFrancais.get()))
             self.txtFrancais.focus()
             return
     if e == True:
         if tkMessageBox.askquestion(_(u"Doublons détectés"), _(u"Le mot %s \"%s\" est déjà dans le dictionnaire. Êtes-vous certain de l'associer à un second mot %s ?") %(self.langue, etranger, application_language))=="no":
             self.txtEtranger.delete(0, len(self.txtEtranger.get()))
             self.txtEtranger.focus()
             return
     self.master.master.addCouple(self.langue, self.dico, francais, etranger)
     Editer(self.master, self.langue, self.dico)
     self.destroy()
Example #6
0
def runn():
    global x
    result = tkMessageBox.askquestion("Rename", "Are You Sure?", icon='warning')
    if result == 'yes':
	    os.system('cp ./* '+x+'/')
	    os.system('cd '+x+'/ && python renamer.py ./')
	    print("renaming done")
	    os.chdir(x+'/')
	    b["state"]="disabled"
            #os.mkdir('unclassifyable')
	    msgx=tkMessageBox.askquestion('SUb folderization',str(len(imagesx))+" images successfully processed Do you wish to do a sub folderization",icon = 'warning')
	    if msgx == 'yes':
		    with open('retrained_labels.txt','a') as yy:
			yy.write('unclassifyable')
		    with open('retrained_labels.txt') as xx:
			    for line in xx:
				line = line.strip()
				os.system('rm -r '+ line)
				os.mkdir(str(line))
				#os.mkdir('unclassifyable')
				for name in glob.glob('./'+line+'*'):
				    os.system('mv '+name[2:]+' ./'+line+'/')
				os.system('find . -empty -type d -delete')
				os.system('/bin/bash exec.sh')
		    os.system('rm *')
		    tkMessageBox.showinfo("Done", "Sub folderization successfull")
Example #7
0
def setTishi(prompt):
    u'''弹出提示对话框,设置提示的内容
        | setTishi               |请输入验证码:
       '''
    top = Tkinter.Tk()
    top.withdraw()
    tkMessageBox.askquestion('提示:  ', prompt)
Example #8
0
 def mostrar_informacion(self, mensaje, titulo=""):
     """
     Muestra una ventana con el mensaje pasado por parametro.
     :param mensaje: Mensaje que se mostrara en la ventana.
     :param titulo: Titulo de la ventana.
     :return: No tiene valor de retorno.
     """
     tkMessageBox.askquestion(titulo, mensaje, type=tkMessageBox.OK, icon="info")
Example #9
0
def obtenerSpinbox():
	#print(valor.get())
	tkMessageBox.showinfo("Mensaje","Tu seleccionaste " + valor.get())
	tkMessageBox.showwarning("Advertencia","Esto es un mensaje de Advertencia")
	tkMessageBox.askquestion("Pregunta 1", "Cualquier cosa")
	tkMessageBox.askokcancel("Pregunta 2", "Cualquier cosa")
	tkMessageBox.askyesno("Pregunta 3", "Cualquier cosa") #Responde en boleano a diferencia del question
	tkMessageBox.askretrycancel("Pregunta 1", "Cualquier cosa")
Example #10
0
    def initialize(self):
        self.grid()
        tkMessageBox.askquestion("Use Local AWS Keys", "Use Local AWS Keys", icon='warning')

        if 'yes':
          self.LocalKeysInitiateDBConnection()
          local_keys = 2
        else:
          self.entryAWSKeyVariable = Tkinter.StringVar()
          self.entryAWSKey = Tkinter.Entry(self, textvariable=self.entryAWSKeyVariable)
          self.entryAWSKey.grid(column=0,row=0,sticky='EW')
          self.entryAWSKeyVariable.set(u"AWS Key")

          self.entryAWSSecretVariable = Tkinter.StringVar()
          self.entryAWSSecret = Tkinter.Entry(self, textvariable=self.entryAWSSecretVariable)
          self.entryAWSSecret.grid(column=0,row=1,sticky='EW')
          self.entryAWSSecretVariable.set(u"AWS Secret Key")
          local_keys = 0
          self.InputKeysInitiateDBConnection()
      
        self.entryVariable = Tkinter.StringVar()
        self.entry = Tkinter.Entry(self,textvariable=self.entryVariable)
        self.entry.grid(column=0,row=2-local_keys,sticky='EW')
        self.entry.bind("<Return>", self.OnPressEnter)
        self.entryVariable.set(u"User .gnupg directory")

        self.key_idLabelVariable = Tkinter.StringVar()
        self.key_id = Tkinter.Label(self,textvariable=self.key_idLabelVariable, anchor="w",wraplength=500)
        self.key_id.grid(column=0,row=3-local_keys,sticky='EW')
        self.key_idLabelVariable.set(u"Key ID")

        self.messageVariable = Tkinter.StringVar()
        self.message = Tkinter.Entry(self,textvariable=self.messageVariable)
        self.message.grid(column=0,row=4-local_keys,sticky='EW')
        self.message.bind("<Return>", self.OnPressEnter)
        self.messageVariable.set(u"Message")

        button = Tkinter.Button(self,text=u"Activate", command=self.OnButtonClick)
        button.grid(column=1,row=0)

        send = Tkinter.Button(self, text=u"Send", command=self.SendMessage)
        send.grid(column=1,row=1)

        recieve = Tkinter.Button(self, text=u"Recieve", command=self.OnRecieveClick)
        recieve.grid(column=1,row=2)

        self.labelVariable = Tkinter.StringVar()
        label = Tkinter.Message(self,textvariable=self.labelVariable, anchor="w")
        label.grid(column=0,row=10-local_keys,rowspan=10,sticky='EW')
        self.labelVariable.set(u"Output")

        self.grid_columnconfigure(0,weight=1)
        self.resizable(True,True)
        self.update()
        self.geometry(self.geometry())       
        self.entry.focus_set()
        self.entry.selection_range(0, Tkinter.END)
Example #11
0
def __load_theme():
    global __theme
    try: # Load theme from file
        with file(__theme_file_path, 'r') as f:
            __theme = json.load(f)
    except ValueError, e: # If there is a JSON error then inform the user
        if __theme_file_exists():
            tkMessageBox.askquestion("Theme File Exception", "Your theme definition file is invalid. Error Message:\n\"" + e.message + "\"", type="ok", icon="error")
            exit(-1)
 def startRename(self):
     path_file = self.selectOriginFileEntry.get()
     path_extract = os.path.dirname(path_file)
     path_extract_name = self.inputTargetDrawableNameEntry.get()
     if len(path_file) > 0 and len(path_extract) > 0 and len(
             path_extract_name) > 0:
         start(path_file, path_extract, path_extract_name)
     else:
         tkMessageBox.askquestion('提示', '请输入正确的数据')
Example #13
0
def messagebox(impulse, count):
    if impulse > 0:
            answer = tkMessageBox.askquestion('Accident Report', 'Do you want to report this accident?')
            if answer == 'yes':
                AccidentReport(count, 'YES')
            else:
                answer_repeatly = tkMessageBox.askquestion('Hit And Run??', 'Do not you want to report this accident? \n If you choose yes, you may be suspected as Hit And Run!!')
                if answer_repeatly == 'yes' :
                    AccidentReport(count, 'NO')
                else:
                    messagebox(impulse,count)
Example #14
0
def obtenerSpinbox():
    #print(valor.get())
    tkMessageBox.showinfo("Mensaje", "Tu seleccionaste " + valor.get())
    tkMessageBox.showwarning("Advertencia",
                             "Esto es un mensaje de Advertencia")
    tkMessageBox.askquestion("Pregunta 1", "Cualquier cosa")
    tkMessageBox.askokcancel("Pregunta 2", "Cualquier cosa")
    tkMessageBox.askyesno(
        "Pregunta 3",
        "Cualquier cosa")  #Responde en boleano a diferencia del question
    tkMessageBox.askretrycancel("Pregunta 1", "Cualquier cosa")
Example #15
0
 def remove_date(self, presentSelection, absentSelection, showConf):
     if presentSelection:
         presentRemove = self.present_date_index[atoi(presentSelection[0])]
         if not showConf or tkMessageBox.askquestion("Deleting Confirmation", "Are you sure you want to permanently remove the date " + str(presentRemove) +" from " + str(self.curStudent) + " ?") == 'yes':
             remove_student_present_date(self.curStudent, presentRemove)
     if absentSelection:
         absentRemove = self.absent_date_index[atoi(absentSelection[0])]
         if not showConf or tkMessageBox.askquestion("Deleting Confirmation", "Are you sure you want to permanently remove the date " + absentRemove +" from " + self.curStudent + " ?") == 'yes':
             remove_student_absent_date(self.curStudent, absentRemove)
     presentDates = get_student_present_dates_from_file(self.curStudent)
     absentDates = get_student_absent_dates_from_file(self.curStudent)
     self.setEditList(presentDates, True)
     self.setEditList(absentDates, False)
Example #16
0
 def check_for_crash(self,head):
     # Check for crash into a wall
     if head[0] > self.s - 1 or head[1] > self.s - 1 or head[0] < 0 or head[1] < 0:
         if tkMessageBox.askquestion("Game over: Score = " + str(len(self.snake))) == "yes":
             self.single_player_game()
         self.quit()
     # Check crash into itself
     for x in self.snake:
         if x[0] == head[0] and x[1] == head[1]:
             if tkMessageBox.askquestion("Game over1: Score = " + str(len(self.snake))) == "yes":
                 self.single_player_game()
                 break
             self.quit()
Example #17
0
    def _generateMatrices(self):
        threshold = int(self.threshold.get())
        margeColor = int(self.margeColor.get(), 16)
        mask, colorList = GazeParser.ScanMatch.generateMaskFromArray(
            self.dataArray, threshold, margeColor)

        if len(colorList) > 12:
            tkMessageBox.showinfo(
                'Info',
                'Mask matrix and color list are generated.\nEdit Submatrix manually because color list is too long (>12)'
            )
            saveSubmatrix = 'no'
        else:
            saveSubmatrix = tkMessageBox.askquestion(
                'Info',
                'Mask matrix and color list are generated.\nInput data for Submatrix?'
            )
            if saveSubmatrix == 'yes':
                submatrix = self._inputSubMatrix(colorList)
                if submatrix == None:
                    res = tkMessageBox.askquestion(
                        'Error',
                        'Invalid value is found.\nSave only mask matrix and color list?'
                    )
                    if res == 'no':
                        return
                    else:
                        saveSubmatrix = 'no'

        maskfile = tkFileDialog.asksaveasfilename(title='Save Mask matrix...',
                                                  initialfile='mask.txt',
                                                  initialdir=homeDir)
        if maskfile != '':
            numpy.savetxt(maskfile, mask, fmt='%d')

        colorfile = tkFileDialog.asksaveasfilename(title='Save color list...',
                                                   initialfile='colorlist.txt',
                                                   initialdir=homeDir)
        if colorfile != '':
            numpy.savetxt(colorfile, colorList, fmt='%06x', delimiter=',')

        if saveSubmatrix == 'yes':
            subfile = tkFileDialog.asksaveasfilename(
                title='Save Submatrix...',
                initialfile='submatrix.txt',
                initialdir=homeDir)
            if subfile != '':
                numpy.savetxt(subfile, submatrix, fmt='%f', delimiter=',')

        tkMessageBox.showinfo('Info', 'Done!')
Example #18
0
 def get_word(self):
     word = self.r.nameInput.get() or 'sb'
     #print word
     self.clean(word)
     while True:
         flag = tkMessageBox.askquestion(word)
         time.sleep(10)
Example #19
0
def Write_to_sreial(EdNetID,EdNodeID,com):
	#init serial
	ser=serial.Serial(com)
	ser.baudrate=38400
	#ser.open()
	Openflag=False
        Openflag=ser.isOpen()

	sendData="FF"+EdNetID.get()+EdNodeID.get()


	if Openflag==True: 
		MessageBoxResult=askquestion("Wrte to ROMs","Are you want to Write the ID")
		if MessageBoxResult=='yes':
			#data2int=int(sendData)
			Hexdata=binascii.b2a_hex(sendData)  
			print Hexdata
			Hexdata=Hexdata.decode("hex")

			#print type(Hexdata)
			#Hexdata=hex(data2int)
			#Hexdata=hex(sendData)
			#ser.writelines('\xFF')
			ser.write(Hexdata)
			ser.close()
			print  sendData
			#print  data2int
			print  Hexdata
			showinfo("","done")
		else:
			pass
	else:
		showerror("","fail to open com")
 def keep_podcasts(self):
     y = tkMessageBox.askquestion(
         'Keeping podcasts',
         'Selected podcasts will not be auto-deleted,\nare you sure about this?',
         icon='warning')
     if y == 'yes':
         self.browser.keep_podcasts(self.__curindices())
def confirmGetReimagingWayPoints():
	result = tkMessageBox.askquestion("Get reimaging waypoints?", "Please confirm that you with to get reimaging waypoints")
	if result == 'yes':
		print "Reimaging waypoints"
		#put method calls here
	else:
		print "Did not reimage waypoints"
Example #22
0
 def loop(self):
     import tkMessageBox, traceback
     while self.exit < 0:
         try:
             self.root.tk.dooneevent(TCL_ALL_EVENTS)
         except SystemExit:
             #print 'Exit'
             self.exit = 1
             break
         except KeyboardInterrupt:
             if tkMessageBox.askquestion('Interrupt',
                                         'Really Quit?') == 'yes':
                 # self.tk.eval('exit')
                 return
             else:
                 pass
             continue
         except:
             t, v, tb = sys.exc_info()
             text = ""
             for line in traceback.format_exception(t, v, tb):
                 text += line + '\n'
             try:
                 tkMessageBox.showerror('Error', text)
             except:
                 pass
             tkinspect_quit(1)
    def query_checkbuttons(self):

        selected = set()
        for var in self.program_list:
            value = var.get()
            if value != "":
                selected.add(value)
        installed, uninstalled = get_installed_programs()
        install_package_list = selected - installed
        remove_package_list = installed - selected

        print "uninstalled:", uninstalled
        print "installed:", installed
        print "selected:", selected
        print "remove:", install_package_list
        print "install:", remove_package_list


        if len(install_package_list) == 0 and len(remove_package_list) == 0:
            return

        result = tkMessageBox.askquestion("Degisiklikleri Kaydet", "Bu islem icin internet baglantisi gerekmektedir. Islem yapilsin mi?", icon='warning')
        if result == 'yes':
            pass
        else:
            return

        self.withdraw()
        configure(install_package_list, remove_package_list)
        self.deiconify()
def confirmBeginMission():
	result = tkMessageBox.askquestion("Begin Mission?", "Please confirm that you wish to begin the mission")
	if result == 'yes':
		print "Beginning mission"
		#put method calls here	
	else:
		print "Did not begin mission"
Example #25
0
 def confirmFileTransfer(self, username, fileName):
   message = "User " + username + ' wants to share file ' + fileName + ' with you'
   confirm = tkMessageBox.askquestion("Confirm", message, icon='info')
   if confirm == 'yes':
     return True
   else:
     return False
Example #26
0
    def do_compile(self, project_entry, base_rom_entry, rom_entry):
        base_rom = base_rom_entry.get()
        rom = rom_entry.get()
        project = project_entry.get()

        if base_rom and rom and project:
            self.save_default_tab()

            base_rom_rom = Rom()
            base_rom_rom.from_file(base_rom)
            if base_rom_rom.type == "Earthbound" and len(base_rom_rom) == 0x300000:
                confirm = tkMessageBox.askquestion("Expand Your Base ROM?",
                                                   "You are attempting to compile using a base ROM which is "
                                                   "unexpanded. It is likely that this will not succeed, as CoilSnake "
                                                   "needs the extra space in an expanded ROM to store additional data."
                                                   "\n\n"
                                                   "Would you like to expand this base ROM before proceeding? This "
                                                   "will permanently overwrite your base ROM.",
                                                   icon='warning')
                if confirm == "yes":
                    base_rom_rom.expand(0x400000)
                    base_rom_rom.to_file(base_rom)
            del base_rom_rom

            # Update the GUI
            self.console.clear()
            self.disable_all_components()

            self.progress_bar.clear()

            log.info("Starting compilation...")

            thread = Thread(target=self._do_compile_help, args=(project, base_rom, rom))
            thread.start()
Example #27
0
    def set_java_exe(self):
        system_java_exe = find_system_java_exe()

        if system_java_exe:
            confirm = tkMessageBox.askquestion(
                "Configure Java",
                "CoilSnake has detected Java at the following location:\n\n"
                + system_java_exe + "\n\n"
                + "To use this installation of Java, select \"Yes\".\n\n"
                + "To override and instead use a different version of Java, select \"No\".",
                icon="question"
            )
            if confirm == "yes":
                self.preferences["java"] = None
                self.preferences.save()
                return

        tkMessageBox.showinfo(
            "Select the Java Executable",
            "Select a Java executable for CoilSnake to use.\n\n"
            "On Windows, it might be called \"javaw.exe\" or \"java.exe\"."
        )

        java_exe = tkFileDialog.askopenfilename(
            parent=self.root,
            title="Select the Java Executable",
            initialfile=(self.preferences["java"] or system_java_exe))
        if java_exe:
            self.preferences["java"] = java_exe
            self.preferences.save()
Example #28
0
 def onPaste(self):
     self.w=popupWindow(self,title = "On world, facing north (i.e x increases ahead of you,\n"+
                                                         "and z increases to your right.\n" +
                                                         "Enter origin point (x y z) seperated by spaces: eg. 12 12 12:")
     self.wait_window(self.w.top)
     data = self.w.value.split(' ')
     try:
         xo = int(data[0])
         yo = int(data[1])
         zo = int(data[2])
         if tkMessageBox.askquestion('Coords', "Is this (x,y,z) correct: " + str(xo) +',' +str(yo) + ',' + str(zo)) == 'yes':
             print 'Pasting'
             count = 0
             for j,i in enumerate(self.levels):
                 for key,value in i.iteritems():
                     xr = int(xo + key[0])
                     yr = int(yo + j)
                     zr = int(zo + key[1])
                     # self.client.client_send(xr,yr,zr,0)
                     if int(value) != 0:
                         self.client.client_send(xr,yr,zr,int(value))
                         count = count + 1
                     if count % NUMPERSEC == 0:
                         time.sleep(1)
         else:
             pass
     except ValueError:
         pass
 def underVote():
     value = tkMessageBox.askquestion(title = "What?",
                                     message = "You haven't voted properly. Do you want to move to the next section?")
     if value == "yes":
         return True
     else:
         return False
Example #30
0
def delFile():
	
	# dictionary to store the hashes and file names from the test files
	testHash = dict()
	# open the file chooser dialogue
	fileName = askopenfilename()
	# reset the hasher to ensure matches for identical files
	hasher = hashlib.md5()

	# get the file, hash it and store both in dictionary
	with open(fileName, 'rb') as afile:
		buf = afile.read()
		hasher.update(buf)
		testHash[fileName]=hasher.hexdigest()
		afile.close()

	if (checkFile(testHash)):
		#remove both the the file name/path and the resulting hash from the text file
		result = tkMessageBox.askquestion("Delete", "Are You Sure You Want\nTo Remove This File?", icon='warning')
		if result == 'yes':
			with open("workfile") as f:
			    with open("temp", "w") as f1:
				for line in f:
					for name, sig in testHash.items():
					    if not sig in line:
						f1.write(line)			
			tkMessageBox.showinfo("File Delete", "File Deleted")
			try:
				os.remove("workfile")
				os.renames("temp", "workfile")
			except OSError, e:  ## if failed, report it back to the user ##
				print ("Error: %s - %s." % (e.filename,e.strerror))
Example #31
0
 def encrypt(self):
     a = tkMessageBox.askquestion("tishi", "Do you want to encrypt?")
     if a == 'yes':
         self.encry = Tk()
         self.encry.title("Encryption")
         Label(self.encry,
               text="Input the key or generate a pair of key:").grid(
                   row=0, column=0)
         Label(self.encry, text="Private key:").grid(row=1, column=0)
         self.key1 = Entry(self.encry)
         self.key1.grid(row=1, column=1, sticky=W)
         Label(self.encry, text="Private key:").grid(row=1, column=2)
         self.key2 = Entry(self.encry)
         self.key2.grid(row=1, column=3, sticky=W)
         Button(self.encry, text="OK", command=self.cal).grid(row=1,
                                                              column=4)
         Button(self.encry,
                text="Generate a pair of key",
                command=self.gene).grid(row=1, column=5)
         Label(self.encry,
               text="The encrypted file position :").grid(row=2, column=0)
         self.filename1 = Entry(self.encry)
         self.filename1.grid(row=2, column=1)
         Button(self.encry, text="Start",
                command=self.file_encry).grid(row=2, column=2)
Example #32
0
def restart():
    result = tkMessageBox.askquestion("Restart MazeBuilder", "Are you sure you restart.?"
                                                             "\nAll unsaved changes will be lost", icon='warning')
    if not result == "yes":
        return
    subprocess.Popen(["python", "main.py"])
    exit(0)
def confirmStopImaging():
	result = tkMessageBox.askquestion("Stop Imaging?", "Please confirm that you with to end imaging")
	if result == 'yes':
		print "Stopping imaging"
		#put method calls here
	else:
		print "Did not stop imaging"
def confirmSendImagesToJudges():
	result = tkMessageBox.askquestion("Send images to judges?", "Please confirm that you wish to send captured images for judging")
	if result == 'yes':
		print "Sending Images"
		#put method calls here
	else:
		print "Did not send images to judges"
Example #35
0
 def glue(self, nch=64, fs=100):
     sortkeys = sorted(self.data.keys())
     if len(sortkeys):
         files = [self.data[sortkey]["filename"] for sortkey in sortkeys]
         fulldata = get_raw_data(files[0])
         lastvalue = fulldata[-64:]
         for ind, _file in enumerate(files[1:]):
             data = get_raw_data(_file)
             bufferdata = np.tile(lastvalue, int(fs * self.buffer[ind]))
             fulldata = np.concatenate((fulldata, bufferdata, data))
         if len(sortkeys) == 1:
             if fulldata.shape[0] / nch < 360000:
                 print("Adding some constant data at the end")
                 bufferdata = np.tile(lastvalue,
                                      360000 - int(fulldata.shape[0] / nch))
                 fulldata = np.concatenate((fulldata, bufferdata))
         ### CHECK LENGTHS
         print(self.totallen, " == ", fulldata.shape[0] / nch, "?")
         # saving file
         asksave = messagebox.askquestion(
             "Saving glued data",
             "Do you want to save glued data into file?",
             icon='warning')
         if asksave == 'yes':
             savefile = filedialog.asksaveasfilename(
                 title="Save datafile as...",
                 defaultextension="",
                 initialdir=dirn(files[0]),
                 initialfile="GLUED" + base(files[0]))
             write_data(savefile, fulldata)
 def eliminar():
     ide = e1.get()
     if ide == "":
         tkMessageBox.showinfo("Alerta del sistema", "no encontrado")
         print("not found")
     cursor.execute(
         "SELECT cedula, Nombre, Apellido, telefono, dirección from USUARIO WHERE cedula = '" + ide + "'"
     )
     for raw in cursor:
         salida_eliminar = Label(ventana3, text=raw, font=("Ravie", 10), fg="blue", bg="white").pack(
             side="bottom"
         )
         marco = """\n Datos de la Búsqueda"""
         mostrar = Label(ventana3, text=marco, bg="white", fg="blue", font=("Ravie", 14)).pack(side="bottom")
         print("ready for erase")
     busca = cursor.execute(
         "SELECT cedula, Nombre, Apellido, telefono, dirección from USUARIO WHERE cedula = '" + ide + "'"
     )
     comprueba = busca.fetchone()
     if comprueba == None:
         print("not found")
         tkMessageBox.showerror("Alerta del sistema", "No registrado")
     else:
         resp = tkMessageBox.askquestion("Eliminar del Sistema", "¿Seguro quiere eliminar?", icon="warning")
         if resp == "no":
             print("not erase")
         else:
             e1.delete(0, END)
             cursor.execute("DELETE from USUARIO WHERE cedula = '" + ide + "'")
             showinfo("Alerta del sistema", "Eliminado con éxito")
             cnn_db.commit()
             print("erased")
         ventana3.destroy()
Example #37
0
 def onScaleButtonClick(self):
     #Check If Valid Image Directory Selected
     if(self.fileSelected):
         #Confirm File Overwrite
         choice = tkMessageBox.askquestion("Save","Overwrite Existing Image With Scaled Version?",icon="warning")
         if choice == "yes":
             #Rescale File
             image = self.scaleFile()
             #Check Image Was Scaled Successfully
             if image != None:
                 #Overwrite Selected File With Existing File
                 self.saveFile(image)
             else:
                 self.showError("Error During Image Scale!")
                 return None
         else:
             #Cancel Scale Operation
             self.showInfo("Scale Operation Cancelled!")
             return None
     else:
         self.showError("No File Selected!")
         
     #Clear File Directory
     self.fileSelected = False
     #Reset File Infov
     self.openVar.set("No File Selected")
     self.clearFileInfo()
Example #38
0
 def resetBalance(self):
     target = self.nameEntry.get()
     names = []
     IDs = []
     debts = []
     with open(self.master.userFile) as f:
         for name,ID,owed in csv.reader(f):
             names += [name]
             IDs += [ID]
             debts += [owed]
     if target in names:
         index = names.index(target)
         result = tkMessageBox.askquestion("Reset balance", "Are You Sure?", icon='warning')
         if result == 'yes':
             debts[index] = 0
             with open(self.master.userFile, 'w') as f:
                 w = csv.writer(f)
                 usersList = zip(names, IDs, debts)
                 for line in usersList:
                     w.writerow(line)
             print "Reset"
         else:
             print "Cancelled"
     else:
         print "Target user not found."
 def delete_podcasts(self):
     y = tkMessageBox.askquestion(
         'Deleting files',
         'Selected podcasts will be deleted,\nare you sure about this?',
         icon='warning')
     if y == 'yes':
         self.browser.delete_podcasts(self.__curindices())
Example #40
0
    def startCallBack(self):
        if not self.fileEntry.get():
            tkMessageBox.showerror(u'\u932f\u8aa4',
                                   u'\u8acb\u9078\u64c7\u76ee\u9304')
            return

        if self.selectYears.get() == "Designated" and not self.yearEntry.get():
            tkMessageBox.showerror(
                u'\u932f\u8aa4',
                u'\u8acb\u4f9d\u7167\u683c\u5f0f\u8f38\u5165\u6307\u5b9a\u5e74\u4efd\uff0c\u5982 2014,2015,Present'
            )
            return

        if self.selectYears.get() == "Designated" and self.yearEntry.get():
            try:
                nums = self.yearEntry.get().split(",")
            except:
                tkMessageBox.showerror(
                    u'\u8acb\u4f9d\u7167\u683c\u5f0f\u8f38\u5165\u6307\u5b9a\u5e74\u4efd\uff0c\u5982 2014,2015,Present'
                )
                return
        else:
            nums = []

        result = tkMessageBox.askquestion(
            u'\u78ba\u5b9a',
            u'\u78ba\u5b9a\u958b\u59cb\u55ce\uff1f',
            icon='warning')

        if result == 'no':
            return
        else:
            self.root.after(0, lambda: self.__run_it__(nums))
Example #41
0
def hisdel():
    if os.path.isfile(histfile):  #ファイルの存在確認
        ret = msb.askquestion("履歴削除", "履歴を削除しちゃうよ!")  #問い合わせダイアログ表示
        if ret == 'yes':
            os.remove(histfile)  #ファイル削除
    else:
        msb.showinfo("履歴なし", "今んとこ履歴は無いよ!")  #メッセージボックス表示
Example #42
0
 def onClear(self):
     if self.altAction == 1:
         self.w=popupWindow(self,title = "Enter the arguments start_level end_levels to clear\n" +
                                                              "seperated by a space.")
         self.wait_window(self.w.top)
         self.altAction = 0
         data = self.w.value.split()
         try:
             if len(data) == 2:
                 st,sto = sorted((data[0],data[1]))
                 st = int(st)
                 sto = int(sto)
                 for i in range(st,sto+1):
                     if i < len(self.levels):
                         self.levels[i] = dict()
                         self.signs[i] = dict()
                 self.redraw_level()
             else:
                 print 'Not enough arguments'
         except ValueError:
             print 'Error in values'
     else:
         if tkMessageBox.askquestion('Clear', "Clear Level: " + str(self.curr_level)) == 'yes':
             self.levels[self.curr_level] = dict()
             self.signs[self.curr_level] = dict()
             self.redraw_level()
         else:
             pass
Example #43
0
 def exit(self):
     """
     Quitte l'application
     """
     result = tkMessageBox.askquestion("Quitter l'application?", "Etes vous sur de vouloir quitter l'application?", icon='warning')
     if result == 'yes':
         exit(0)
def abrir():
    global original, imSerializable
    imSerializable = askopenfilename(filetypes=[("PNG", "*.png"), \
                                          ("JPEG", "*.jpeg"), \
                                          ("GIF", "*.gif"), \
                                          ("JPEG", "*.jpg")])

    label.destroy()
    imSerializable = Image.open(imSerializable)
    largo, ancho = imSerializable.size

    if largo > 800 or ancho > 800:
        respuesta = tkMessageBox.askquestion(
            "¡ IMPORTANTE !",
            "Su fotografia acaba de superar el limite permitido y no cabe en la pantalla \n\n 1) Puede reducir el tamaño de ella para poder editarla (perdera calidad y pixeles) \n\n2) Trabajar con la imagen real, pero no podra ver los retoques hasta haberla guardado\n\n SI -> REDUCIR\n\n NO-> MANTENER TAMAÑO REAL "
        )
        if respuesta == "yes":
            recortada = imSerializable.resize((640, 480))
            original = recortada
            imSerializable = recortada
            refresca(recortada)
            tkMessageBox.showinfo("Mensaje", "Imagen Reducida Correctamente")
        else:
            muyGrande = Image.open("grande.jpeg")
            muyGrande = muyGrande.resize((640, 353))
            original = imSerializable
            refresca(muyGrande)
    else:
        original = imSerializable
        refresca(imSerializable)
Example #45
0
 def personel_menu():
     result = tkMessageBox.askquestion(
         "3dPrinter",
         "Bir Önceki Personel Menüsüne Dönmek İstiyor musunuz ?",
         icon='warning')
     if result == 'yes':
         controller.show_frame(LoginPage)
Example #46
0
    def set_java_exe(self):
        system_java_exe = find_system_java_exe()

        if system_java_exe:
            confirm = tkMessageBox.askquestion(
                "Configure Java",
                "CoilSnake has detected Java at the following location:\n\n" +
                system_java_exe + "\n\n" +
                "To use this installation of Java, select \"Yes\".\n\n" +
                "To override and instead use a different version of Java, select \"No\".",
                icon="question")
            if confirm == "yes":
                self.preferences["java"] = None
                self.preferences.save()
                return

        tkMessageBox.showinfo(
            "Select the Java Executable",
            "Select a Java executable for CoilSnake to use.\n\n"
            "On Windows, it might be called \"javaw.exe\" or \"java.exe\".")

        java_exe = tkFileDialog.askopenfilename(
            parent=self.root,
            title="Select the Java Executable",
            initialfile=(self.preferences["java"] or system_java_exe))
        if java_exe:
            self.preferences["java"] = java_exe
            self.preferences.save()
Example #47
0
	def clear(self, event=None):
		ans = tkMessageBox.askquestion(_("Delete autolevel information"),
			_("Do you want to delete all autolevel in formation?"),
			parent=self.winfo_toplevel())
		if ans!=tkMessageBox.YES: return
		self.app.gcode.probe.clear()
		self.draw()
    def begin(self, cmd_func, move_func):
        self.cmd_func = cmd_func
        self.move_func = move_func
        self.coaster.begin()
        while not self.coaster.is_NL2_accessable():
            self.master.update_idletasks()
            self.master.update()
            result = tkMessageBox.askquestion(
                "Waiting for NoLimits Coaster",
                "Coaster Sim not found, Start NoLimits and press Yes to retry, No to quit",
                icon='warning')
            if result == 'no':
                sys.exit(0)

        while True:
            self.master.update_idletasks()
            self.master.update()
            if self.coaster.connect_to_coaster():
                #  print "connected"
                self.coaster.set_manual_mode()
                break
            else:
                print "Failed to connect to coaster"
                print "Use shortcut to run NoLimits2 in Telemetry mode"

        if self.coaster.is_NL2_accessable():
            self.gui.set_coaster_connection_label(
                ("Coaster Software Connected", "green3"))
        else:
            self.gui.set_coaster_connection_label(
                ("Coaster Software Not Found"
                 "(start NL2 or maximize window if already started)", "red"))
Example #49
0
def Write_to_sreial(EdNetID, EdNodeID, com):
    #init serial
    ser = serial.Serial(com)
    ser.baudrate = 38400
    #ser.open()
    Openflag = False
    Openflag = ser.isOpen()

    sendData = "FF" + EdNetID.get() + EdNodeID.get()

    if Openflag == True:
        MessageBoxResult = askquestion("Wrte to ROMs",
                                       "Are you want to Write the ID")
        if MessageBoxResult == 'yes':
            #data2int=int(sendData)
            Hexdata = binascii.b2a_hex(sendData)
            print Hexdata
            Hexdata = Hexdata.decode("hex")

            #print type(Hexdata)
            #Hexdata=hex(data2int)
            #Hexdata=hex(sendData)
            #ser.writelines('\xFF')
            ser.write(Hexdata)
            ser.close()
            print sendData
            #print  data2int
            print Hexdata
            showinfo("", "done")
        else:
            pass
    else:
        showerror("", "fail to open com")
Example #50
0
    def build_model(self):
        # build the kmeans model
        if not self.is_pre_processed:
            tkMessageBox.showerror(title=self.head_title, message="pre processing is not validated yet")
            return

        if self.cluster is not None:
            # if we already ran the clustering, verify if we really want to run it again
            result = tkMessageBox.askquestion(
                message="clustering has already been made.\nare you sure you want to run it again?",
                icon='warning', title=self.head_title)
            if result != 'yes':
                return
        self.cluster = None
        try:
            # create the kmeans model
            self.n_clusters = self.n_clusters_text.get()
            self.n_init = self.n_init_text.get()
            model = BuildCluster(self.n_clusters, self.n_init, self.processor.df)
            if model.verifications() is False:
                tkMessageBox.showerror(title=self.head_title, message=model.error_message)
                return

            model.build_cluster()
            self.cluster = model
            # draw the graphs in the gui
            self.draw_graphs()
            tkMessageBox.showinfo(title=self.head_title, message='Clustering Finished successfully!')
        except Exception as err:
            template = "An exception of type {0} occurred. Arguments:{1}"
            message = template.format(type(err).__name__, err)
            print_exc(err, file=stdout)
            tkMessageBox.showerror(title=self.head_title, message=message)
Example #51
0
 def reset_app(self):
     answer = tkMessageBox.askquestion(
         "Resetting " + self.App,
         "Are you sure you want to proceed? \nAny unsaved work will be lost"
     )
     if answer == "yes":
         self.ChimeraInterface.CloseModels()
         self.ChimeraInterface = None
         self.fulltext = ""
         self.prevtext = ""
         self.latvectime = time.time()
         self.lattice.set(0)
         self.LatVecButton.config(state=Tk.DISABLED)
         self.updateText(self.App + " starting...\n")
         self.getWorkingDir()
         if self.App == "Tetr":
             self.ChimeraInterface = tetr_lev00_Chimera_plugin.Tetr(
                 self.rootdir, self.wkdir, self.myshell)
         else:
             self.ChimeraInterface = tetr_lev00_Chimera_plugin.Lev00(
                 self.rootdir, self.wkdir, self.myshell)
             self.lev00radio[1].config(state=Tk.DISABLED)
             self.levvoption.set(0)
         time.sleep(self.pausetime)
         self.updateText(self.ChimeraInterface.getOutput())
         self.ChimeraInterface.refreshGeom()
         self.SetViewOption()
         self.axis_toggle()
         self.ToggleLatticeVectors()
         self.wdirlabel.config(text="wkdir= '" + self.wkdir + "'")
         self.UpdateLabels()
         self.timer()
Example #52
0
    def pre_process(self):
        # pre process the data to fit into the algorithm
        if self.processor is not None:
            # if we already ran this, ask the user if he wants to run it again
            result = tkMessageBox.askquestion(
                message="pre-processing has already been made.\nare you sure you want to run it again?'",
                icon='warning', title=self.head_title)
            if result != 'yes':
                return
        self.processor = None
        self.is_pre_processed = False
        try:
            # verify the file can be pre-processed
            self.file_path = self.file_path_text.get()
            processor = PreProcess(self.file_path)
            if processor.verifications() is False:
                tkMessageBox.showerror(title=self.head_title, message=processor.error_message)
                return

            # process the data
            processor.pre_process()
            tkMessageBox.showinfo(title=self.head_title, message='Preprocessing completed successfully')
            self.processor = processor
            self.is_pre_processed = True
        except Exception as err:
            template = "An exception of type {0} occurred. Arguments:{1}"
            message = template.format(type(err).__name__, err)
            print_exc(err, file=stdout)
            tkMessageBox.showerror(title=self.head_title, message=message)
Example #53
0
 def text_encry(self):
     a = tkMessageBox.askquestion("tishi", "Do you want to encrypt?")
     if a == 'yes':
         self.tencry = Tk()
         self.tencry.title("Encryption")
         Label(self.tencry,
               text="Input the key or generate a pair of key:").grid(
                   row=0, column=0)
         Label(self.tencry, text="Private key:").grid(row=1, column=0)
         self.keya = Entry(self.tencry)
         self.keya.grid(row=1, column=1, sticky=W)
         Label(self.tencry, text="N :").grid(row=1, column=2)
         self.keyb = Entry(self.tencry)
         self.keyb.grid(row=1, column=3, sticky=W)
         Button(self.tencry, text="OK", command=self.cal3).grid(row=1,
                                                                column=4)
         Button(self.tencry,
                text="Generate a pair of key",
                command=self.gene1).grid(row=1, column=5)
         Label(
             self.tencry,
             text=
             "The encrypted text will be shown in the initial text window."
         ).grid(row=2, column=0)
         Button(self.tencry, text="Start",
                command=self.text_en).grid(row=2, column=2)
Example #54
0
def should_kill_other_tribler_instances():
    """ Asks user whether to force restart Tribler if there is more than one instance running.
        This will help user to kill any zombie instances which might have been left behind from
        previous force kill command or some other unexpected exceptions and relaunch Tribler again.
        It ignores if Tribler is opened with some arguments, for eg. with a torrent.
     """
    # If there are cmd line args, let existing instance handle it
    if len(sys.argv) > 1:
        return

    # Get PIDs of existing tribler instance
    pids = get_existing_tribler_pids()

    # If the PID list is not empty, then there is another Tribler instance running
    # Ask user whether to force restart
    if pids:
        import Tkinter
        import tkMessageBox
        window = Tkinter.Tk()
        window.withdraw()
        result = tkMessageBox.askquestion("Warning", FORCE_RESTART_MESSAGE, icon='warning')
        if result == 'yes':
            for pid in pids:
                os.kill(pid, 9)
            window.update()
            window.quit()

            # Restart Tribler properly
            restart_tribler_properly()
        else:
            window.update()
            window.quit()
            sys.exit(0)
Example #55
0
    def GetOpenFileName(self, Type):
        if self.IsConfigDataLoaded():
            if Type == 'dlt':
                Question = 'Configuration will be changed using Delta file, continue ?'
            elif Type == 'bin':
                Question = 'All configuration will be reloaded from BIN file, continue ?'
            elif Type == 'dsc':
                Question = 'All configuration will be reloaded from DSC file, continue ?'
            else:
                raise Exception('Unsupported file type !')
            Reply = tkMessageBox.askquestion('', Question, icon='warning')
            if Reply == 'no':
                return None

        if Type == 'dsc':
            FileType = 'DSC or PKL'
            FileExt = 'pkl *Def.dsc'
        else:
            FileType = Type.upper()
            FileExt = Type

        Path = tkFileDialog.askopenfilename(initialdir=self.LastDir,
                                            title="Load file",
                                            filetypes=(("%s files" % FileType,
                                                        "*.%s" % FileExt),
                                                       ("all files", "*.*")))
        if Path:
            self.LastDir = os.path.dirname(Path)
            return Path
        else:
            return None
def confirmBeginImaging():
	result = tkMessageBox.askquestion("Begin Imaging?", "Please confirm that you with to begin imaging")
	if result == 'yes':
		print "Beginning imaging..."
		#put method calls here
	else:
		print "Did not start imaging"
Example #57
0
def display_question(question, answer_type):
    if answer_type == 'long':
        popup = tk.Toplevel()

        popup.minsize(400, 100)
        popup.maxsize(400, 100)

        question_label = tk.Label(popup, text=question, height=0, width=100)
        question_label.place(x=10, y=10, width=300, height=20)

        path_txt = tk.StringVar()
        path_entry = tk.Entry(popup, textvariable=path_txt)
        path_entry.place(x=10, y=30, width=300, height=20)

        search_path_button = tk.Button(
            popup,
            text="...",
            command=lambda: open_dialog_box('dir', 'set_one', path_txt))
        search_path_button.place(x=320, y=30, width=60, height=20)

        ok_button = tk.Button(popup,
                              text="OK",
                              command=lambda: popup.destroy())
        ok_button.place(x=200, y=50, width=60, height=40)

        popup.focus_force()

        launchGUI.main.wait_window(popup)

        result = path_txt.get()
    else:
        result = tkMessageBox.askquestion("Installation",
                                          question,
                                          icon='warning')
    return result
Example #58
0
 def gui_addsat(self):
     'Gui button to add the satellite tracks'
     from tkMessageBox import askquestion
     answer = askquestion('Verify import satellite tracks','Do you want to get the satellite tracks from the internet?')
     if answer == 'yes':
         from map_interactive import load_sat_from_net, get_sat_tracks, plot_sat_tracks
         self.line.tb.set_message('Loading satellite kml File from internet')
         kml = load_sat_from_net()
         if kml:
             self.line.tb.set_message('parsing file...')
             sat = get_sat_tracks(self.line.ex.datestr,kml)
             self.line.tb.set_message('Plotting satellite tracks')
             self.sat_obj = plot_sat_tracks(self.line.m,sat)
     elif answer ==  'no':
         from map_interactive import load_sat_from_file, get_sat_tracks, plot_sat_tracks
         filename = self.gui_file_select(ext='.kml',ftype=[('All files','*.*'),
                                                      ('Google Earth','*.kml')])
         if not filename:
             print 'Cancelled, no file selected'
             return
         self.line.tb.set_message('Opening kml File:'+filename)
         kml = load_sat_from_file(filename)
         self.line.tb.set_message('parsing file...')
         sat = get_sat_tracks(self.line.ex.datestr,kml)
         self.line.tb.set_message('Plotting satellite tracks') 
         self.sat_obj = plot_sat_tracks(self.line.m,sat)
     self.line.get_bg()