AppBase API

AppBase is simple skeleton application framework that allows modelling in Model → View → Controller style.

AppBase.py

Skeleton MVC application module.

Provides three base classes for application build.

copyright:
  1. 2021 by Fr. Br. George

license:

MIT, see COPYING for more details.

class AppBase.Control(model)

Trivial program controller.

Parameters:

model – Model part of MVC framework

_dump(*args, **kwargs)

Just print all agruments.

setup()

Command Model to set up stuff.

class AppBase.Model(view)

Trivial program logic.

Parameters:

view – View part of MVC framework

_dump(*args, **kwargs)

Just print all agruments.

class AppBase.View(master=None, title='<application>', control=None, **kwargs)

Sample tkinter View class.

Parameters:
  • master – master window (tkinter root if None)

  • title – application window title

  • control – the Control part of MVC framework

_(cls, master, geom=':', *args, **kwargs)

Create a widget, set up geometry and adjust master’s column/row weights.

Parameters:
  • cls – widget class

  • master – master widget to embed

  • geom – geometry string

  • args – positional arguments tuple for cls() call

  • kwargs – named arguments tuple for cls() call

Geometry string may (not) include any of the following fields:

row+span.weight:row+column.weight/gravity
Column, row:

Master’s grid column and row to place the widget. Default is 0.

Span:

Additional colunm or row to span. Default is 0.

Weight:

Master’s grid colunm or row weight (last definition wins). Default is 1.

Gravity:

Widget gravity in tkinter standard form. Default is NEWS.

E. g. 3.0:+2 is equivalent to 3.0+0:0.1+2, column number 3, with zero (fixed) weight, spanned from row number zero to 2, with default weght of 1.

_varbind(var, callback, *args)

Bind control callback to a tk.variable var.

assingbindings()

Assign controller bindings.

createWidgets()

Create all the widgets.