
Window is not responding when opened before the mouse.wait function. If replace the mouse.wait function to another (which doesn't waiting the mouse click), the window will open normally.
import pyautogui, sys, mouse
from PySide2 import QtWidgets
from design import Ui_Form, Ui_Next
def mpos(file):
mouse.wait(button='right', target_types='down')
x,y=pyautogui.position()
file.write(str(x)+'_'+str(y)+'-')
def prog():
with open('prog.txt', 'w') as file:
next()
mpos(file)
next()
mpos(file)
next()
mpos(file)
def menu():
mui.configButton.clicked.connect(prog)
wmenu.show()
def fclose():
wnext.close()
def next():
nui.okButton.clicked.connect(fclose)
wnext.show()
app = QtWidgets.QApplication(sys.argv)
wmenu = QtWidgets.QFrame()
mui = Ui_Form()
mui.setupUi(wmenu)
wnext = QtWidgets.QFrame()
nui = Ui_Next()
nui.setupUi(wnext)
menu()
sys.exit(app.exec_())