Giter VIP home page Giter VIP logo

pythonguitemplate's Introduction

Python GUI Template

A basic template for making a GUI in Python using Traits. It gives you access to a matplotlib canvas object and Mayavi 3D rendering object which can be dynamically updated by adjusting the objects on the right panel. Tabbed viewing is also enabled by default.

Requirements

There are two options to get you going, either:

  • you will need Enthought's EPD distribution (32-bit, not 64-bit as it does not include Mayavi) which can be found here. You will need an academic license to access it for free (simply requires a .edu email address). Go to the next step to install EPD if this is your choice (or if you are a beginner).

or,

  • if you don't use EPD, you will need to change the Common.py file to have the header not use EPD's distribution. Simply replace the following where appropriate (you will need TraitsUI v5.0 or above however):
from traits.api import *
from traitsui.api import View,UItem, Item, Group, Heading, Label, \
        HSplit, Handler, CheckListEditor, EnumEditor, TableEditor, FileEditor, \
        ListEditor, Tabbed, VGroup, HGroup, RangeEditor, Spring, spring
from traitsui.menu import NoButtons
from traitsui.wx.editor import Editor
from traitsui.wx.basic_editor_factory import BasicEditorFactory
from traitsui.api import ColorTrait

If you do not have TraitsUI v5.0 or above, then you will get black backgrounds and odd interface errors. This took me quite some time to solve so please heed my advice!

If you are a beginner or new to Python, I suggest you install EPD (pacakge manager for Python and its tools):

bash epd-7.3-2-rh5-x86.sh ('rh3' for older operating systems) or just use the .dmg image for OSX.

Running GUI

Run ipython then run main.py or python main.py outright. If you get errors, you will likely also have to install wxpython. Install via conda install wxpython. If you are on Mac OSX, you then run via pythonw main.py. On Ubuntu you just run python main.py.

Adding your own features.

There is very comprehensive documentation on using Traits here and a lot of tutorials. I will be giving a few introductory sessions on my blog as well.

Screenshots

Detault view upon launch.

An example of the some of the features within Traits.
Example 1

Gnarly, dynamic updates!
Example 2

Example of enabling options when particular criteria are met.
Example 3

pythonguitemplate's People

Contributors

bgriffen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.