Skip to content

jazzycamel/PyQt5Singleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyQt5Singleton

A simple singleton implementation to work with PyQt5

Installation

Using pip:

$ pip install PyQt5Singleton

or clone this repo, install dependencies and run install:

$ git clone https://github.com/jazzycamel/PyQt5Singleton.git
$ cd PyQt5Singleton
$ pip install -r requirements.txt
$ python setup.py install

Usage

from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty
from PyQt5Singleton import Singleton

class MyObject(QObject, metaclass=Singleton):
    def __init__(self, parent=None, **kwargs):
        super().__init__(parent, **kwargs)

        self._x=0

    def x(self): return self._x

    @pyqtSlot(int)
    def setX(self, x): self._x=x

    x=pyqtProperty(int, x, setX)

if __name__=="__main__":
    print(MyObject().x)
    MyObject().x=1
    print(MyObject().x)

About

A simple singleton implementation to work with PyQt5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages