# soloman [![Downloads](https://pepy.tech/badge/soloman)](https://pepy.tech/project/soloman)
For the love of python and qml
[refer to milestone](https://github.com/deuteronomy-works/soloman/milestone/12)
## Installation
pip install soloman
## Python Usage
### Play audio
```python
from soloman import Audio
aud = Audio()
aud.play('/path/to/music.mp3')
```
## Qml Usage
example.py
```python
import soloman
...
engine = QQmlApplicationEngine()
...
engine.load('example.qml')
```
### Play audio
*example.qml*
```qml
import QtQuick 2.15
...
import soloman 2.5
SAudio {
id: aud
}
Button {
text: "Play"
onClicked: aud.play('path/to/music.mp3')
}
```
### Play videos
*example.qml*
#### Play a video file
```qml
import QtQuick 2.15
...
import soloman 2.5
SVideo {
id: vid
}
Button {
text: "Play video"
onClicked: vid.play('path/to/video.mp4')
}
```
### Play stills
##### Option one
```qml
...
onClicked: vid.play('path/to/video_stills_01.jpg') # possibly the first image
...
```
##### Option two
```qml
...
onClicked: vid.play('path/to/') # make sure folder contains only stills
...
```
### Show cv2 frame
example.py
```python
import sys
import cv2
import threading
from time import sleep
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml QQmlApplicationEngine
import soloman
app = QGuiApplication(sys.argv)
# Create a QML engine.
engine = QQmlApplicationEngine()
engine.quit.connect(app.quit)
engine.load(QUrl('example.qml'))
# Get SVideo
vid = soloman.Video(engine)
vid.get_SVideo('screen_01') # objectName goes here
# Capture
capture = cv2.VideoCapture(0) # capture camera
def start_capt():
# start thread
o_thread = threading.Thread(target=_start_capt)
o_thread.daemon = True
o_thread.start()
def _start_capt():
while True:
ret, frame = capture.read()
if not ret:
break
vid.show_frame(frame)
sleep(1/24)
# Call to start capturing
start_capt()
# Run the app
ret_value = app.exec_()
capture.release()
sys.exit(0)
```
example.qml
```qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import solomon 2.5
ApplicationWindow {
visible: true
width: 800
height: 500
SVideo {
objectName: "screen_01" // declare objectName to be used in python
}
}
```
## Wiki
The wiki can be located [here](https://github.com/deuteronomy-works/soloman/wiki)
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
最新资源
- 施工安全检测21-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- 低价几何画板Sketchpad 5.06
- 2017&2015年国家级风景名胜区分布数据
- 2016年全国自然保护区分布
- Jenkins 2024/12 最新版本: 2.479.2 LTS
- IMG_6962.PNG
- Firebird BBS源代码
- Python爬虫-城市数据分析与市场潜能计算所需文件-283地级市数据.xlsx
- 施工场地车检测16-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、VOC数据集合集.rar
- Python爬虫-城市数据分析与市场潜能计算所需文件-283地级市的欧氏距离.xlsx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈