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
Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021)

Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021)

Jiaxi Jiang 282 Jan 02, 2023
This is the repository for paper NEEDLE: Towards Non-invertible Backdoor Attack to Deep Learning Models.

This is the repository for paper NEEDLE: Towards Non-invertible Backdoor Attack to Deep Learning Models.

1 Oct 25, 2021
Search and filter videos based on objects that appear in them using convolutional neural networks

Thingscoop: Utility for searching and filtering videos based on their content Description Thingscoop is a command-line utility for analyzing videos se

Anastasis Germanidis 354 Dec 04, 2022
[CVPR 2021] Unsupervised 3D Shape Completion through GAN Inversion

ShapeInversion Paper Junzhe Zhang, Xinyi Chen, Zhongang Cai, Liang Pan, Haiyu Zhao, Shuai Yi, Chai Kiat Yeo, Bo Dai, Chen Change Loy "Unsupervised 3D

100 Dec 22, 2022
DeepFaceEditing: Deep Face Generation and Editing with Disentangled Geometry and Appearance Control

DeepFaceEditing: Deep Face Generation and Editing with Disentangled Geometry and Appearance Control One version of our system is implemented using the

260 Nov 28, 2022
Rethinking the U-Net architecture for multimodal biomedical image segmentation

MultiResUNet Rethinking the U-Net architecture for multimodal biomedical image segmentation This repository contains the original implementation of "M

Nabil Ibtehaz 308 Jan 05, 2023
Data and code from COVID-19 machine learning paper

Machine learning approaches for localized lockdown, subnotification analysis and cases forecasting in São Paulo state counties during COVID-19 pandemi

Sara Malvar 4 Dec 22, 2022
FairFuzz: AFL extension targeting rare branches

FairFuzz An AFL extension to increase code coverage by targeting rare branches. FairFuzz has a particular advantage on programs with highly nested str

Caroline Lemieux 222 Nov 16, 2022
🔎 Monitor deep learning model training and hardware usage from your mobile phone 📱

Monitor deep learning model training and hardware usage from mobile. 🔥 Features Monitor running experiments from mobile phone (or laptop) Monitor har

labml.ai 1.2k Dec 25, 2022
Sample and Computation Redistribution for Efficient Face Detection

Introduction SCRFD is an efficient high accuracy face detection approach which initially described in Arxiv. Performance Precision, flops and infer ti

Sajjad Aemmi 13 Mar 05, 2022
Neural Nano-Optics for High-quality Thin Lens Imaging

Neural Nano-Optics for High-quality Thin Lens Imaging Project Page | Paper | Data Ethan Tseng, Shane Colburn, James Whitehead, Luocheng Huang, Seung-H

Ethan Tseng 39 Dec 05, 2022
PyTorch implementation of DeepDream algorithm

neural-dream This is a PyTorch implementation of DeepDream. The code is based on neural-style-pt. Here we DeepDream a photograph of the Golden Gate Br

121 Nov 05, 2022
A Broad Study on the Transferability of Visual Representations with Contrastive Learning

A Broad Study on the Transferability of Visual Representations with Contrastive Learning This repository contains code for the paper: A Broad Study on

Ashraful Islam 29 Nov 09, 2022
Visual dialog agents with pre-trained vision-and-language encoders.

Learning Better Visual Dialog Agents with Pretrained Visual-Linguistic Representation Or READ-UP: Referring Expression Agent Dialog with Unified Pretr

7 Oct 08, 2022
Junction Tree Variational Autoencoder for Molecular Graph Generation (ICML 2018)

Junction Tree Variational Autoencoder for Molecular Graph Generation Official implementation of our Junction Tree Variational Autoencoder https://arxi

Wengong Jin 418 Jan 07, 2023
High-performance moving least squares material point method (MLS-MPM) solver.

High-Performance MLS-MPM Solver with Cutting and Coupling (CPIC) (MIT License) A Moving Least Squares Material Point Method with Displacement Disconti

Yuanming Hu 2.2k Dec 31, 2022
Dynamic Token Normalization Improves Vision Transformers

Dynamic Token Normalization Improves Vision Transformers This is the PyTorch implementation of the paper Dynamic Token Normalization Improves Vision T

Wenqi Shao 20 Oct 09, 2022
Free like Freedom

This is all very much a work in progress! More to come! ( We're working on it though! Stay tuned!) Installation Open an Anaconda Prompt (in Windows, o

2.3k Jan 04, 2023
Datasets, Transforms and Models specific to Computer Vision

torchvision The torchvision package consists of popular datasets, model architectures, and common image transformations for computer vision. Installat

13.1k Jan 02, 2023
Capture all information throughout your model's development in a reproducible way and tie results directly to the model code!

Rubicon Purpose Rubicon is a data science tool that captures and stores model training and execution information, like parameters and outcomes, in a r

Capital One 97 Jan 03, 2023