PyQt/Demo/SharedMemory.py

35 lines
693 B
Python
Raw Normal View History

2017-03-30 22:26:58 +08:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2021-07-13 14:52:26 +08:00
"""
2017-03-30 22:26:58 +08:00
Created on 2017年3月30日
2021-07-13 14:52:26 +08:00
@author: Irony
@site: https://pyqt.site , https://github.com/PyQt5
2017-03-30 22:26:58 +08:00
@email: 892768447@qq.com
@file: TestQSharedMemory
@description:
2021-07-13 14:52:26 +08:00
"""
2017-03-30 22:26:58 +08:00
2021-07-13 14:52:26 +08:00
from PyQt5.QtWidgets import QWidget
2017-03-30 22:26:58 +08:00
2019-01-01 17:04:10 +08:00
from Lib.Application import SharedApplication # @UnresolvedImport
2017-03-30 22:26:58 +08:00
class Widget(QWidget):
2021-07-13 14:52:26 +08:00
def __init__(self, *args, **kwargs):
super(Widget, self).__init__(*args, **kwargs)
2017-03-30 22:26:58 +08:00
if __name__ == "__main__":
2021-07-13 14:52:26 +08:00
import sys, os
2017-03-30 22:26:58 +08:00
print(os.getpid())
app = SharedApplication(sys.argv)
if app.isRunning():
print("app have already running")
sys.exit(0)
w = Widget()
w.show()
2021-07-13 14:52:26 +08:00
sys.exit(app.exec_())