PyQt6 configuration in yaml format providing the most simple script.

Overview

PyamlQt(ぴゃむるきゅーと)

PyPI version

PyQt6 configuration in yaml format providing the most simple script.

Requirements

  • yaml
  • PyQt6, ( PyQt5 )

Installation

pip install PyamlQt

Demo

python3 examples/chaos.py

Template

See examples/simple_gui.py.

import sys
import os

from pyamlqt.create_widgets import create_widgets
import pyamlqt.qt6_switch as qt6_switch

qt6_mode = qt6_switch.qt6

if qt6_mode:
    from PyQt6.QtWidgets import QApplication, QMainWindow
else:
    from PyQt5.QtWidgets import QApplication, QMainWindow

YAML = os.path.join(os.path.dirname(__file__), "../yaml/chaos.yaml")

class MainWindow(QMainWindow):
    def __init__(self):
        self.number = 0
        super().__init__()

        # geometry setting ---
        self.setWindowTitle("Simple GUI")
        self.setGeometry(0, 0, 800, 720)
        
        # Template ==========================================
        self.widgets, self.stylesheet = self.create_all_widgets(YAML)
        for key in self.widgets.keys():
            self.widgets[key].setStyleSheet(self.stylesheet[key])
        # ==============================================

        # --- Your code ----
        # -*-*-*-*-*-*-*-*-*
        # -----------------
        
        self.show()

    # Template ==========================================
    def create_all_widgets(self, yaml_path: str) -> dict:
        import yaml
        widgets, stylesheet_str = dict(), dict()
        with open(yaml_path, 'r') as f:
            self.yaml_data = yaml.load(f, Loader=yaml.FullLoader)
        
            for key in self.yaml_data:
                data = create_widgets.create(self, yaml_path, key, os.path.abspath(os.path.dirname(__file__)) + "/../")
                widgets[key], stylesheet_str[key] = data[0], data[1]

        return widgets, stylesheet_str
    # ==============================================

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MainWindow()
    # sys.exit(app.exec_())
    sys.exit(app.exec())

Elements (dev)

In yaml, you can add the following elements defined in PyQt.Widgets This may be added in the future.

  • pushbutton : definition of QPushButton
  • qlabel : definition of QLabel
  • qlcdnumber : definition of QLCDNumber
  • qprogressbar : definition of QProgressBar
  • qlineedit : definition of QLineEdit
  • qcheckbox : definition of QCheckbox
  • qslider : definition of QSlider
  • qspinbox : definition of QSpinBox
  • qcombobox : definition of QCombobox
  • image : definition of QLabel (using image path)
  • stylesheet : definition of Stylesheet (define as QLabel and setHidden=True)

YAML format

PyamlQt defines common elements for simplicity. Not all values need to be defined, but if not set, default values will be applied

key: # key name (Required for your scripts)
  type: slider # QWidgets
  x_center: 500 # x center point
  y_center: 550 # y center point
  width: 200 # QWidgets width
  height: 50 # QWidgets height
  max: 100 # QObject max value
  min: 0 # QObject min value
  default: 70 # QObject set default value
  text: "Slider" # Text
  font_size: 30 # Text size [px]
  font_color: "#ff0000" # Text color
  font: "Ubuntu" # Text font
  font_bold: false # bold-text option
  items: # Selectable items( Combobox's option )
    - a
    - b
    - c

PyQt5 Mode

If you want to use PyQt5, you have to change the qt6_switch.py file.

  • Open the file and change the qt6_mode variable to False.
  • pip3 install PyQt5
  • pip3 install -v -e .
You might also like...
Hi Guys, here I am providing examples, which will help you in Lerarning Python

LearningPython Hi guys, here I am trying to include as many practice examples of Python Language, as i Myself learn, and hope these will help you in t

NVIDIA Merlin is an open source library providing end-to-end GPU-accelerated recommender systems, from feature engineering and preprocessing to training deep learning models and running inference in production.

NVIDIA Merlin NVIDIA Merlin is an open source library designed to accelerate recommender systems on NVIDIA’s GPUs. It enables data scientists, machine

phylotorch-bito is a package providing an interface to BITO for phylotorch

phylotorch-bito phylotorch-bito is a package providing an interface to BITO for phylotorch Dependencies phylotorch BITO Installation Get the source co

arxiv-sanity, but very lite, simply providing the core value proposition of the ability to tag arxiv papers of interest and have the program recommend similar papers.
arxiv-sanity, but very lite, simply providing the core value proposition of the ability to tag arxiv papers of interest and have the program recommend similar papers.

arxiv-sanity, but very lite, simply providing the core value proposition of the ability to tag arxiv papers of interest and have the program recommend similar papers.

ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.
ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.

ManimML ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.

Sequential Model-based Algorithm Configuration

SMAC v3 Project Copyright (C) 2016-2018 AutoML Group Attention: This package is a reimplementation of the original SMAC tool (see reference below). Ho

My personal Home Assistant configuration.

About This is my personal Home Assistant configuration. My guiding princile is to have full local control of all my devices. I intend everything to ru

Interactive Terraform visualization. State and configuration explorer.
Interactive Terraform visualization. State and configuration explorer.

Rover - Terraform Visualizer Rover is a Terraform visualizer. In order to do this, Rover: generates a plan file and parses the configuration in the ro

Gin provides a lightweight configuration framework for Python

Gin Config Authors: Dan Holtmann-Rice, Sergio Guadarrama, Nathan Silberman Contributors: Oscar Ramirez, Marek Fiser Gin provides a lightweight configu

Releases(v0.3.0)
  • v0.3.0(Apr 28, 2022)

    Japanese

    PyamlQtはGUIデザイン初心者のためのGUI定義フォーマットです。コントリビューション大歓迎です!

    しばらくはAPIの破壊的変更が行われる可能性があります。

    変更点

    • 新しいモジュールPyamlQtWindow
      • 初期化には引数が必要です。(README.mdを読んでください)
      • デモプログラムがとてもシンプルになりました。

    English

    PyamlQt is a GUI definition format for GUI design beginners. Contributions are welcome!

    There is a possibility of destructive changes to the API for the time being.

    Changes

    • New module PyamlQtWindow.
      • Arguments are required for initialization. (Please read README.md)
      • The demo program is now very simple.

    import sys
    import os
    
    from pyamlqt.mainwindow import PyamlQtWindow
    from PyQt6.QtWidgets import QApplication
    
    YAML = os.path.join(os.path.dirname(__file__), ". /yaml/chaos.yaml")
    
    class MainWindow(PyamlQtWindow):
        def __init__(self):
            self.number = 0
            super(). __init__("title", 0, 0, 800, 720, YAML)
            self.show()
    
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        window = MainWindow()
        sys.exit(app.exec())
    
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Apr 13, 2022)

    Japanese

    PyamlQtはGUIデザイン初心者のためのGUI定義フォーマットです。コントリビューション大歓迎です!

    しばらくはAPIの破壊的変更が行われる可能性があります。

    変更点

    • rect要素とstyle要素を追加し、stylesheetの仕様が大きく変更されました。
    • 複数のyamlからのロードをサポートします。パスは絶対パスを指定するか、GitHubなどのソースコードへのURL(raw.githubusercontent.com に続くURL)を指定してください。
      • URL指定する場合は~/.cache/pyamlqt/yaml以下にyamlがダウンロードされます。
      • ロード先のyamlファイルで同じファイル名・同じキー名を指定しないでください。再帰的にロードされてメモリを消費し続けます。

    English

    PyamlQt is a GUI definition format for GUI design beginners. Contributions are welcome!

    The API may undergo destructive changes for a while.

    Changes

    • The specification of stylesheet has been significantly changed with the addition of the rect and style elements.
    • Support for loading from multiple yaml files. Paths should be absolute paths or URLs to source code such as GitHub (URLs following raw.githubusercontent.com).
      • If you specify a URL, the yaml will be downloaded under ~/.cache/pyamlqt/yaml.
      • Do not specify the same file name and the same key name in the yaml file to be loaded. They will be loaded recursively and continue to consume memory.
    Source code(tar.gz)
    Source code(zip)
Owner
Ar-Ray
1st grade of National Institute of Technology(=Kosen) student. Associate degree, Hatena Blogger
Ar-Ray
TensorFlow 101: Introduction to Deep Learning for Python Within TensorFlow

TensorFlow 101: Introduction to Deep Learning I have worked all my life in Machine Learning, and I've never seen one algorithm knock over its benchmar

Sefik Ilkin Serengil 896 Jan 04, 2023
Official Pytorch implementation of 'RoI Tanh-polar Transformer Network for Face Parsing in the Wild.'

Official Pytorch implementation of 'RoI Tanh-polar Transformer Network for Face Parsing in the Wild.'

Jie Shen 125 Jan 08, 2023
PyTorch Lightning implementation of Automatic Speech Recognition

lasr Lightening Automatic Speech Recognition An MIT License ASR research library, built on PyTorch-Lightning, for developing end-to-end ASR models. In

Soohwan Kim 40 Sep 19, 2022
Search Youtube Video and Get Video info

PyYouTube Get Video Data from YouTube link Installation pip install PyYouTube How to use it ? Get Videos Data from pyyoutube import Data yt = Data("ht

lokaman chendekar 35 Nov 25, 2022
Official implementation for "Image Quality Assessment using Contrastive Learning"

Image Quality Assessment using Contrastive Learning Pavan C. Madhusudana, Neil Birkbeck, Yilin Wang, Balu Adsumilli and Alan C. Bovik This is the offi

Pavan Chennagiri 67 Dec 30, 2022
Learning to Identify Top Elo Ratings with A Dueling Bandits Approach

Learning to Identify Top Elo Ratings We propose two algorithms MaxIn-Elo and MaxIn-mElo to solve the top players identification on the transitive and

2 Jan 14, 2022
It is a system used to detect bone fractures. using techniques deep learning and image processing

MohammedHussiengadalla-Intelligent-Classification-System-for-Bone-Fractures It is a system used to detect bone fractures. using techniques deep learni

Mohammed Hussien 7 Nov 11, 2022
Implementation of the final project of the course DDA6309 Probabilistic Graphical Model

Task-aware Joint CWS and POS (TCwsPos) This is the implementation of the final project of the course DDA6309 Probabilistic Graphical Models, The Chine

Peng 1 Dec 26, 2021
Code of the paper "Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition"

SEW (Squeezed and Efficient Wav2vec) The repo contains the code of the paper "Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speec

ASAPP Research 67 Dec 01, 2022
[NeurIPS 2021] PyTorch Code for Accelerating Robotic Reinforcement Learning with Parameterized Action Primitives

Robot Action Primitives (RAPS) This repository is the official implementation of Accelerating Robotic Reinforcement Learning via Parameterized Action

Murtaza Dalal 55 Dec 27, 2022
PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks

Code for the paper "PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks" (ICPR 2020)

Wenwen Yu 498 Dec 24, 2022
A toolkit for Lagrangian-based constrained optimization in Pytorch

Cooper About Cooper is a toolkit for Lagrangian-based constrained optimization in Pytorch. This library aims to encourage and facilitate the study of

Cooper 34 Jan 01, 2023
Blind visual quality assessment on 360° Video based on progressive learning

Blind visual quality assessment on omnidirectional or 360 video (ProVQA) Blind VQA for 360° Video via Progressively Learning from Pixels, Frames and V

5 Jan 06, 2023
Poisson Surface Reconstruction for LiDAR Odometry and Mapping

Poisson Surface Reconstruction for LiDAR Odometry and Mapping Surfels TSDF Our Approach Table: Qualitative comparison between the different mapping te

Photogrammetry & Robotics Bonn 305 Dec 21, 2022
This repository contains code to run experiments in the paper "Signal Strength and Noise Drive Feature Preference in CNN Image Classifiers."

Signal Strength and Noise Drive Feature Preference in CNN Image Classifiers This repository contains code to run experiments in the paper "Signal Stre

0 Jan 19, 2022
Learning Versatile Neural Architectures by Propagating Network Codes

Learning Versatile Neural Architectures by Propagating Network Codes Mingyu Ding, Yuqi Huo, Haoyu Lu, Linjie Yang, Zhe Wang, Zhiwu Lu, Jingdong Wang,

Mingyu Ding 36 Dec 06, 2022
Measuring Coding Challenge Competence With APPS

Measuring Coding Challenge Competence With APPS This is the repository for Measuring Coding Challenge Competence With APPS by Dan Hendrycks*, Steven B

Dan Hendrycks 218 Dec 27, 2022
Unofficial TensorFlow implementation of Protein Interface Prediction using Graph Convolutional Networks.

[TensorFlow] Protein Interface Prediction using Graph Convolutional Networks Unofficial TensorFlow implementation of Protein Interface Prediction usin

YeongHyeon Park 9 Oct 25, 2022
Real Time Object Detection and Classification using Yolo Algorithm.

Real time Object detection & Classification using YOLO algorithm. Real Time Object Detection and Classification using Yolo Algorithm. What is Object D

Ketan Chawla 1 Apr 17, 2022
Rule Based Classification Project For Python

Rule-Based-Classification-Project (ENG) Business Problem: A game company wants to create new level-based customer definitions (personas) by using some

Deniz Can OĞUZ 4 Oct 29, 2022