I have a problem with plotting graph. my code with the console works fine, but with Qt, the problem began. I need to see a graph, then to choose, if it is good (to complete), or bad (to skip it), and go on.
in the console I used (input), with Qt, I used (QtWidgets.QMessageBox.question) and (input). with Qt, the graph shows in the background, and the question pops up, and I can't do nothing with the graph or see it until I answer the question in the message. and what I need is to answer the question after cheeking the graph.
def graphic_show(self):
count_folder = 1
count_file = 1
res=''
file = QtWidgets.QFileDialog.getExistingDirectory()
z = 0
while z == 0:
y = str(count_folder) # folder name
y_2 = str(count_file) # file name
# for xj in range(1,32):
# print("I'm here...2")
#xj = int(str(self.lineEdit_15.text()))
source = Path(os.getcwd() + '/' + 'Data File' + '/' + y +'/' + y+ '5', y_2 + '_new'+'5'+'.txt')
dest = Path(y_2 +'5'+'.txt') # точка 1
# source = Path(os.getcwd() + '/' + 'Data File' + '/' + y +'/' + y+ str(self.lineEdit_15.text()), y_2 + '_new'+str(self.lineEdit_15.text())+'.txt')
# dest = Path(y_2 +str(self.lineEdit_15.text())+'.txt') # точка 1
with open(source,'r') as rs, open(dest,'w') as dst:
dst.write(rs.read())
with open(dest , 'r' )as ff:
x1 = ff.readlines()
x1 = [float(i) for i in x1]
x2 = x1[0:100]
zero1 = statistics.mean(x2)
peaks = find_peaks(x1, height=zero1+100,distance = 10)
height = peaks[1]['peak_heights'] # list of the heights of the peaks
peak_pos = peaks[0] # list of the peaks positions
np.savetxt('индекс_пика.txt',peak_pos,fmt=['%d'])
np.savetxt('пик.txt',height,fmt=['%.2f'])
fig = plt.figure()
ax = fig.subplots()
ax.plot(x1)
ax.scatter(peak_pos, height, color = 'r', s = 15, marker = 'D', label = 'max')
ax.legend()
ax.grid()
plt.show()
check = QtWidgets.QMessageBox.question(self,'Is it good?', ' is the file good?',
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No,
QtWidgets.QMessageBox.stop)
if ckeck == QtWidgets.QMessageBox.Yes:
count_folder = count_folder + 1
count_file = count_file + 1
pass
elif QtWidgets.QMessageBox.No:
zero_cor = input(' enter the value to correct the zero!')
zero1 = float(zero_cor)....
The same thing happens if I use the (input) instead of (QtMessage).
plt.show()
g = input('is the file good??')
if g == 'y':
count_folder = count_folder + 1
count_file = count_file + 1