python - QPixmap Line Being Skipped -


i have following piece of code:

def run(self):         filename = qtgui.qfiledialog.getsavefilename(self, "save file", "", ".inp")         if filename == "":             pass         elif filename != "":             nfile = open(filename, 'w')             self.pixmap1 = qtgui.qpixmap('yellow.jpg')             self.canvas1.setpixmap(self.pixmap1)             self.cursor.moveposition(self.cursor.start, self.cursor.moveanchor)             self.cursor.moveposition(self.cursor.end, self.cursor.keepanchor)             text = self.cursor.selection()             text1 = text.toplaintext()             nfile.write(text1)             nfile.close()             fileinfo = qtcore.qfileinfo(filename)             name = fileinfo.basename()              import os             os.system("rungms {}.inp 13-64 {} {} {}.out".format(name, self.cores_val, self.clusters_val, name))              itertools import islice             import sys              open("{}.out".format(name)) searchfile:                 line in searchfile:                     if 'terminated normally' in line:                         self.pixmap1 = qtgui.qpixmap('green.jpg')                         self.canvas1.setpixmap(self.pixmap1)                     elif 'job aborted' in line:                         self.pixmap1 = qtgui.qpixmap('red.jpg')                         self.canvas1.setpixmap(self.pixmap1)                     else:                         pass         else:             pass 

my problem 2 lines involving qpixmap('yellow.jpg') not being read after saving file. however, if move these 2 lines in between first , second lines of code (i.e. before filename = qtgui...), work.

can explain me why case?


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -