from PyQt5.Qt import QMainWindow,QDialog
import json
window=QMainWindow()
def save_location(self):
with open('window_location.txt','w') as f:
data={'x':self.window.x(),'y':self.window.y()}
f.write(json.dumps(data))
def load_laction(self):
with open('window_location.txt', 'r') as f:
txt=f.read()
print(txt)
j=json.loads(txt)
return j
如果需要在每次拖动窗口的时候都触发这个的话需要重写窗口类了,在我的进阶日志里后续会写上
power by 弗兰克万岁 2897994820@qq.com
网友评论