Coder Social home page Coder Social logo

qtmodularuipack's Introduction

QtModularUiPack

A module for quick and easy creation of PyQt5 applications. Creating sophisticated and versatile user interfaces is a task which often involves a lot of effort. While in science and engineering there is often a lack of resources to invest in the development of user interface applications. This Python module aims to provide a very simple way of creating scale-able user interface applications. The module is based on the popular PyQt5 framework which is a Python wrapper based on the C++ library Qt5 (https://pypi.org/project/PyQt5/).

Installation

To install the module you can use the pip package installer for Python. Type the following command on the command line of your operating system:

pip install QtModularUiPack

First Steps

To check if the module is working properly open a python command prompt and type the following commands:

from QtModularUiPack.Widgets import ModularApplication
ModularApplication.standalone_application(title='MyApp', window_size=(640, 480))

This should produce a Qt user interface window with the title "MyApp" and the given size.

modular_application

This empty window has a single button containing three dots. Clicking this button reveals a drop-down menu. Choose "View->Tool Command Line", this will change the window to a fully functional Python command prompt (ToolCommandFrame-widget).

console_test

The real power of the ModularApplication-widget lies in its ability to be subdivided and display different widgets simultaneously. To illustrate this again click the menu and then choose "split horizontally".

split

This will split the window and shows a new empty frame. In the new window choose "View->Hello World Frame". This will open the HelloWorldFrame-widget.

hello_world_widget

Some of the widgets in this module have the ability to access and change data in other widgets. One example of this is the ToolCommandFrame-widget on the left side of the window. Type the following in the command part of the widget:

tools.help()

This should show two items: console, hello_world. Both entries represent one found data-context in the ModularApplication-widget. The first entry "console" is the variable containing the data-context of the ToolCommandFrame-widget and "hello_world" contains the data-context of the HelloWorldFrame-widget. To access the HelloWorldFrame-widget type the following in the console:

tools.hello_world.switch()

Where "switch()" is a function provided by the data-context of the HelloWorldFrame-widget. Notice how the upper and lower text fields have swapped their contents.

hello_world_switch

This simple example serves to illustrate how modular applications can greatly simplify the communication between independent parts of an application. Lab automation which is a common subject in experimental science, this can be utilized to control mandy different devices while keeping the code for each device completely seperate. The ModularApplication-widget handles adding and removal of other widgets dynamically and notifies so called "context-aware" widgets about changes.

Advanced Topics

qtmodularuipack's People

Contributors

dowerner avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.