GithubHelp home page GithubHelp logo

jarvisteach / appjar Goto Github PK

View Code? Open in Web Editor NEW
615.0 40.0 67.0 24.16 MB

Simple Tkinter GUIs in Python

Home Page: http://appJar.info

License: Other

Python 91.36% Shell 0.10% Tcl 8.54%
tkinter python gui education appjar

appjar's Introduction

appJar

Simple tKinter GUIs in Python


PyPI Version Build Status Test Coverage Code Health Code Climate irc

Download Here: https://github.com/jarvisteach/appJar/raw/appJar/releases/appJar.zip

Docs here: http://appJar.info

This provides a library for implementing easy GUIs...

Installation:

  • Download the ZIP file (click the big green button) & unzip it
  • Add it to your path:
    • make a folder in your home directory, called PYLIB, and put appJar inside it
    • On mac/linux add this to your .bashrc: export PYTHONPATH=~/PYLIB:$PYTHONPATH
    • On Windows, add a new environment variable
  • Give it a twirl:
    • Check the docs folder, for a couple of PDFs with help.
    • Check the Lessons folder, for some example code.

Example:

from appJar import gui  
app = gui("Example")  
app.addLabel("label1", "Hello World")  
app.go()  

or (using context managers):

from appJar import gui  
with gui("Example") as app:
    app.addLabel("label1", "Hello World")  

or (using simple naming):

from appJar import gui  
with gui("Example") as app:
    app.label("Hello World")  

Reasoning:

  • Designed to be as easy as possible, yet still provide a lot of tkinter functionality

  • Provides 3 functions for most widgets:

    • add(name, value) this adds a new widget (usually with a name and a value)
    • set(name, value) this updates the value of the named widget
    • get(name) this gets the value of the named widget
  • Uses grid layout

  • When adding widgets, up to 4 numerical "positions" can be supplied:

    • column - the coloumn to appear in, starting at 0
    • row - row to appear in, stating at 0
    • columnspan - how many columns to span across
    • rowspan - how many rows to span down
  • Provides loads of extra bits and pieces outside of core tkinter

    • Some of this was from the excellent resources @ http://effbot.org
    • Some of this was from slashdot examples of how to solve common problems
    • Some of this has been incorporated from other people's modules:
      • ToolTip support form Michael Lange
      • png support using James Wright's tkinter-png and Johann C. Rocholl's png.py libraries
      • jpeg support using NanoJPEG from Martin J. Fiedler
  • I've tried to get as much functionality into this library as possible, without requiring any other modules

appjar's People

Contributors

a-deluna avatar bluekenny avatar cowsay652 avatar frakman1 avatar gotocode avatar jacobthetechy avatar jarvisteach avatar jonwchapman avatar simoneu01 avatar wapmorgan avatar yotabits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appjar's Issues

Refactor code to use new config style

The Properties widget uses a new method for propagating config properties.
It overrides the config functions, and deals with the different options.
This is much better than previous methods of having multiple setters.

This should be implemented across all the container widgets:
config

In fact, this should be done to all classes:


Containers

  • SubWindow
  • ScrollPane
  • PagedWindow, Page
  • ToggleFrame
  • Pane
  • AutoScrollbar
  • ParentBox, LabelBox, ButtonBox, WidgetBox, ListBoxContainer
  • TabbedFrame
  • ajFrame

Basic Widgets

  • SelectableLabel
  • TextParent, AjText, AjScrolledText
  • AjScale
  • AutoCompleteEntry
  • Separator
  • Link
  • Grip
  • Meter, SplitMeter, DualMeter

Complex Widgets

  • Properties
  • Dialogs...
  • SplashScreen
  • SimpleGrid
  • MicroBitSimulator
  • PieChart
  • ajTreeNode, ajTreeData
  • GoogleMap
  • AjRectangle, Point

Look into rowspan sticking to TOP/BOTTOM

When rowspan is populated, sticky is still only EW
This can be overridden by user
Maybe default widgets with a rowspan to auto stick to top & bottom?
This can be done in __positionWidget()
But need to be careful not to override user settings for container/widget

See issue #38

appJar branding

Set all GUIs to have appJar icon
Configure menu options help/about - to give information about appJar & link to site

Improve Scale Widget

Remove label from scale, include addLabelScale.

Change orientScaleHor - better name, and change functionality - default is horizontal, so this function's job is to make it vertical...

Look into layout of scale - is it vertically centred?

AnimatedImage Caching

Animated images are cached - that means if the same image is used more than once, the animation loop goes into overdrive, and if the animation is stopped - it affects all copies of that image

Investigate/Fix padding settings

Padding doesn't work particularly well at the moment:

  1. The initial window is padded 2 x/y which can't be changed - it should be configurable.
  2. It's possible to setPadX/setPadY - but these actually set iPadX/iPadY of the current container - which in turn is applied to all widgets, giving them the specified internal padding.

Instead:

  • Allow the user to set generic & widget specific internal/external x/y paddings
  • Allow the user to specify a padding for entire window, defaulting to 2

OptionBox - default entry

Have the choice to include a "selection" message
When getSelected is called, it should return None
Maybe just pass in an empty list item, or a dash, or have a named function?

Ability to get widgets

Would be useful to have easy way to access a widget - so that tkinter commands can be called on it directly

Should implement a getter, in the same way setters are done.

PieChart work needed

Need to:

  • finish mouseEvents, show number with mouse over
  • add functionality to change data
  • add functionality to set properties
  • test hide/remove, positioning in different containers

Weird Issue with initial window focus

Not convinced the GUI is properly receiving the focus when it starts up.

Evidence:

  • Menus don't work until you alt-tab
  • buttons/check boxes/etc don't get blue highlight straight away

Not noticed on Windows, but definitely something fishy on Mac

TabbedFrame work

Need to rework setting colours:

TabbedWindow foreground states:

  • activeforeground - the selected tab
  • foreground - other tabs
  • disabledforeground - disabled tabs

TabbedWindow background states:

  • activebackground - the selected tab & all panes
  • background - container's BG
  • (NEW) inactivebackground - other tabs

Can change a single Tab's background

Work on Menu Support

Some changes to menus:

  • add support for menu dictionaries
  • add support for adding single items to menus
  • add support for checkbox/radiobutton
  • add support for cross-platform special menus
  • look into cross-platform tearable support
  • look into adding images to menus

Issue with positioning images on buttons

Code works differently on Windows & Mac.

See the setButtonImage function, the two code snippets are there - this needs testing, and a resolution found. Either a platform decision, or a universal solution.

SpinBox in reverse order

SpinBox items are in the opposite order to expected

So the initial action is to scroll up - not right!

Play sounds asynchronously, but let the function wait.

In order to stop the GUI returning, it can be made to wait for a sound to finish playing.

This makes the UI unresponsive.

It would be better to still play the sound asynchronously, but use the UI loop to wait until it's time to return.

AutoScrollBar/ListBox - width changes

When the Autoscrollbar appears on a ListBox (and probably anywhere else) it adds to the widget's width - this makes the GUI change size. Need to find a way to make it's container account for this, so that the size is consistent

No setFg function

Users expect a setFg function, to operate in same way as setBg...

PagedWIndow Container

Requested Page Organiser

Simple navigation from one page to the next: FORWARD/BACK buttons at bottom/top of every page.
No BACK on pg.1 No FORWARD on last page

Then content page should fill whole app. Within frame though, so that status bar/tool bar still valid...

Introduce rowspan feature

Add 4th positioning option - rowspan

Currently, appJar supports positioning in a grid cell by row/column, and also allows a widget to span multiple columns.

There should also be the ability to span multiple rows - this is supported by the grid layout, so is just a case of introducing it to all the add functions.

setImageFolder function

Make the image folder a global variable.
Allow the user to change the folder through a set function.

Maybe auto-check an image directory, if images aren;t found in the current directory...

Unexpected Behaviour - LB/RB/CB

Set functions for ListBox, RadioButton & CheckBox use shorthand form (LB, RB, CB) - this doesn't match rest of app - should use long form version (ListBox, RadioButton, CheckBox). Should keep old versions for backwards compatibility.

App title not right on Windows

If no title is set for the app, it should default to the python file's name
On Mac, this works fine, in Windows it has the entire path - the path is meant to be removed...

Issue with width of optionBox

The OptionBox button defaults to the width of the first item in the list.
This can cause resizing issues, if the column's width is less than the biggest item.
Currently, a fix has been added to set the width to the length of the longest item in the list. This seems to work on Mac, with the default font, but is expected to break with other fonts. Untested on Windows.

Secondly, the drop-down width is different on different platforms. Mac it mimics the button, but on Windows it is smaller than the button. Option to extend width by padding with spaces...

Potential solution here: http://stackoverflow.com/questions/33367443/optionmenu-modify-drop-down-list-width-to-match-optionmenu-width
Need to test on Windows - perhaps do different things on different platforms...

Shelve Widget

Quick way to create 'Shelve Interface':

  • Multiple LabelEntries
  • Buttons

Properties Widget

A quick-to-create set of radio/check boxes.

  • addProperties(props) - Creates the properties box, with the list of properties. The properties can be passed in as dictionary, but the order will be random.
  • addProperty(title, value=False) - Adds the named property to the end of the properties list.
  • getProperties() - Returns the properties as a dictionary.
  • getProperty(title) - Gets the named property.
  • setProperty(title, value=True) - Sets the named property.

SubWindow needs development

SubWindow functionality needs improving:

  • size
  • location (auto centre)
  • transparency
  • background, etc...

Also, think about menu, toolbar, status bar

Refactor ScrollPane & Scrolling Widgets

ScrollPane now pretty solid - so should use for:

  • listbox
  • tree
  • grid
  • textArea

Therefore:

  • remove all scroll related code from widgets
  • have widgets place themselves in a scrollPane
  • position scrollPane in grid

However, scrollPane has lots of components:

  • it is a frame
  • contains 2x scrollbar & 1x canvas
  • canvas contains another frame: interior via create_window

Do we place widgets into interior, or do widgets become interior?
Can widgets replace canvas?

Maybe, make generic ScrollContainer, then:

  • extend to make scrollPane, scrollList, scrollText
  • use scrollPane to position grid & tree

TreeWidget Work

  • Issues with mouse scrolling
  • Issues with registering double click - only applies to root node
  • issues getting currently selected node

statusBar fields

Allow status bar to be configured as a number of labels, each one separately addressable

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.