Monday, 15 September 2014

Python tkinter, do something before subprocess starts -


I'm really having problems with my Python tanker program, in fact, all I want to do is start subprasis For pressing a button and this indicates that the subprocess is running by changing the value of the label. The subproduction takes some time and the problem is that labels are always intended to change the subprocity, which I do not understand, because I can change the label used before a variable and then go along with the subprocess Is waiting for. Here is the code:

  def program_final (): = false start, while this is true: if start == incorrect: v.set ("scanning ...") label.pack () Start = anyone else is true: # P = subprocess.Popen ('sudo NFC choice', shell = true, stdout = subprocess.IPIPE, stderr = subprocess.STDOUT) # A subporocess which is in the background P = subprocess.Popen NFC- The polling opens opens ('Ping 8.8.8.8', shell = true, stdout = subprocess.ipip, stderr = subprocess.STDOUT) counter = 0 output = "lines" = [], while this is true: line = p .stdout.readline () # While the output of the loop lines.insert (counter, line) # subproccess Repeats through lines and = counter saves the whole result in a list counter # 1 to produce the result output, then the counter == 9 will be required: break lines if [6] [7:10] == ' UID ': #Check that the UID line is the current output = output + "tag found! \ N" + line [6] [7:] #If yes, the output string is added to the UL of the allele lines [6] [7] : 10]! = 'UID': = # If the UID line is not present, which means that there is no tag output = output + "no tag found! \ N" #Autput does not find any tag text.delete (1.0, END) #) Removing old tag infosax from textfile text. INTERET (INSERT, Output) # tag Infos or 'no tag found' message has been added to textfield break  

thanks advance.

The tanker update graphic occurs when nothing happens to do this if you have widgets You can force the GUI to refresh using the updated method on want to update.

  tk.updates ()  

No comments:

Post a Comment