Logo
AVC, Application View Controller

OUTLINE

Current: 0.10.0

Released: 24-Apr-2015

License: GPL

Common Requirements:
python 2.2 - <3.0

GTK2+ requirements:
Pygtk 2.8 - 2.10
GTK3+ requirements:
PyGObject >=3.10
Qt requirements:
Pyqt v3 - v4
Tk requirements:
Tkinter 2.4
wxWidgets requirements:
wxPython 2.6 - 2.8
Swing requirements:
jython 2.5.1

Author: Fabrizio Pollastri

DOCUMENTATION

Quick start examples:
GTK2+, GTK3+, Qt, Tk,
wxWidgets, Swing.
User Manual

Release Notes

Changelog

All News

ARTICLES

AVC-Simplifying your GUI Code

SCREENSHOTS

GTK2+ examples

GTK3+ examples

Qt examples

Tk examples

wxWidgets examples

Swing examples

DOWNLOAD

Source:
- current avc-0.10.0.tar.gz
all sources

Packages:
Arch Linux
Debian
Ubuntu

Quick start examples:
GTK2+ spinbutton + glade file
GTK3+ spinbutton + glade file
ui file
Qt spinbox + ui file
Tk spinbox + tcl file
wxWidgets spincontrol + xrc file
Swing spinner

All examples


wxWidgets quick start

This is the wxWidgets spin control example included in AVC distribution. It comes into two versions. The first has the GUI generated from a wxGlade UI description. The second has the GUI generated directly by program instructions. For full details see the "wxWidgwts examples" chapter of the user manual.

Source code: wxGlade version (file wx_spinctrl.py, needs also wx_spinctrl.xrc)
01: #!/usr/bin/python
02: # .+
03: #
04: # .identifier : $Id:$
05: # .context    : Application View Controller
06: # .title      : A spin control replicated into a static text (wx)
07: # .kind       : python source
08: # .author     : Fabrizio Pollastri
09: # .site       : Revello - Italy
10: # .creation   : 24-Nov-2007
11: # .copyright  : (c) 2007 Fabrizio Pollastri.
12: # .license    : GNU General Public License (see below)
13: #
14: # This file is part of "AVC, Application View Controller".
15: #
16: # AVC is free software; you can redistribute it and/or modify
17: # it under the terms of the GNU General Public License as published by
18: # the Free Software Foundation; either version 3 of the License, or
19: # (at your option) any later version.
20: #
21: # AVC is distributed in the hope that it will be useful,
22: # but WITHOUT ANY WARRANTY; without even the implied warranty of
23: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24: # GNU General Public License for more details.
25: #
26: # You should have received a copy of the GNU General Public License
27: # along with this program.  If not, see <http://www.gnu.org/licenses/>.
28: #
29: # .-
30:
31:
32: import wx                               # wx tool kit bindings
33: from wx import xrc                      # xml resource support
34:
35: from avc import *                       # AVC
36:
37: WXGLADE_XML = 'wx_spinctrl.xrc'         # GUI wxGlade descriptor
38:
39:
40: class Example(wx.PySimpleApp,AVC):
41:   """
42:   A spin control whose value is replicated into a static text
43:   """
44:
45:   def __init__(self):
46:
47:     # init wx application base class
48:     wx.PySimpleApp.__init__(self)
49:
50:     # create GUI
51:     xml_resource = xrc.XmlResource(WXGLADE_XML)
52:     self.root = xml_resource.LoadFrame(None,'frame_1')
53:     self.root.Show()
54:
55:     # the variable holding the spin control value
56:     self.spin_value = 0
57:
58:
59: #### MAIN
60:
61: example = Example()                     # instantiate the application
62: example.avc_init()                      # connect widgets with variables
63: example.MainLoop()                      # run wx event loop until quit
64:
65: #### END
66: 
Source code: programmatic version (file wx_spinctrl_progui.py)
01: #!/usr/bin/python
02: # .+
03: #
04: # .identifier : $Id:$
05: # .context    : Application View Controller
06: # .title      : A spin control replicated into a static text (wx)
07: # .kind       : python source
08: # .author     : Fabrizio Pollastri
09: # .site       : Revello - Italy
10: # .creation   : 24-Nov-2007
11: # .copyright  : (c) 2007 Fabrizio Pollastri.
12: # .license    : GNU General Public License (see below)
13: #
14: # This file is part of "AVC, Application View Controller".
15: #
16: # AVC is free software; you can redistribute it and/or modify
17: # it under the terms of the GNU General Public License as published by
18: # the Free Software Foundation; either version 3 of the License, or
19: # (at your option) any later version.
20: #
21: # AVC is distributed in the hope that it will be useful,
22: # but WITHOUT ANY WARRANTY; without even the implied warranty of
23: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24: # GNU General Public License for more details.
25: #
26: # You should have received a copy of the GNU General Public License
27: # along with this program.  If not, see <http://www.gnu.org/licenses/>.
28: #
29: # .-
30:
31:
32: import wx                               # wx tool kit bindings
33:
34: from avc import *                       # AVC
35:
36:
37: class Example(wx.PySimpleApp,AVC):
38:   """
39:   A spin control whose value is replicated into a static text
40:   """
41:
42:   def __init__(self):
43:
44:     ## create GUI
45:
46:     # init wx application base class
47:     wx.PySimpleApp.__init__(self)
48:
49:     # create widgets: a top level window, a static text and a spin control.
50:     root = wx.Frame(None,title='AVC wx spin control example',size=(320,60))
51:     statictext = wx.StaticText(root,label='%s',name='spin_value__statictext',
52:       size=(100,20))
53:     spinctrl = wx.SpinCtrl(root,name='spin_value__spinctrl',size=(100,25))
54:
55:     # layout the static text and the spin control horizontally into the window
56:     hsizer = wx.BoxSizer(wx.HORIZONTAL)
57:     hsizer.Add((20,10),proportion=1)
58:     hsizer.Add(statictext,proportion=0.5,flag=wx.CENTER)
59:     hsizer.Add(spinctrl,proportion=0.5,flag=wx.CENTER)
60:     hsizer.Add((20,10),proportion=1)
61:     root.SetSizer(hsizer)
62:     root.Show()
63:
64:
65:     # the variable holding the spin control value
66:     self.spin_value = 0
67:
68:
69: #### MAIN
70:
71: example = Example()                     # instantiate the application
72: example.avc_init()                      # connect widgets with variables
73: example.MainLoop()                      # run wx event loop until quit
74:
75: #### END
76: