Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yjg30737/random-matrix-generator

Random small dot covered matrix generator
https://github.com/yjg30737/random-matrix-generator

py37 pyqt pyqt-examples pyqt-tutorial pyqt5 pyqt5-examples pyqt5-matrix pyqt5-tutorial python python3 python37 qgraphicsview qt

Last synced: 16 days ago
JSON representation

Random small dot covered matrix generator

Awesome Lists containing this project

README

        

# random-matrix-generator
Random small dot covered matrix generator

## Requirements
PyQt5 >= 5.8

## Setup
```
pip install git+https://github.com/yjg30737/random-matrix-generator.git --upgrade
```

## Example

Code
```python
from PyQt5.QtWidgets import QWidget, QApplication, \
QHBoxLayout, QPushButton

from random_matrix_generator import RandomMatrixGraphicsView

class RmgExample(QWidget):
def __init__(self):
super().__init__()
self.__initUi()

def __initUi(self):
self.setWindowTitle('rmg')
self.__rmg = RandomMatrixGraphicsView()
self.__rmg.setHDotCount(100) # set count of horizontal dots
self.__rmg.setVDotCount(75) # set count of vertical dots
self.__rmg.setDotSize(5) # set the size of each dots
self.__rmg.setBorder(True) # set the border which surrounds the matrix
genBtn = QPushButton('Generate')
genBtn.clicked.connect(self.generate)
lay = QHBoxLayout()
lay.addWidget(self.__rmg)
lay.addWidget(genBtn)

self.setLayout(lay)

def generate(self):
self.__rmg.generate()

if __name__ == "__main__":
import sys

app = QApplication(sys.argv)
rmgExample = RmgExample()
rmgExample.show()
app.exec()
```
Result

![RandomMatrixGenerator](./example/rmgExample.png)

Looks like QR code to me. Not quite the same though, it shall bears a resemblence.

If you click generate button once more, matrix won't reset; It will be more covered by another random generated dots. I will make an option of that soon enough.