Logo
AVC, Application View Controller

OUTLINE

Current: 0.11.0

Released: 23-Feb-2016

License: GPL

Common Requirements:
python 2.7 - 3.4

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

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


Tk quick start

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

Source code: Visual Tcl version (file tk_spinbox.py, needs also tk_spinbox.tcl)
01: #!/usr/bin/python
02: # .+
03: #
04: # .identifier : $Id:$
05: # .context    : Application View Controller
06: # .title      : A spin control replicated into a text label (Tk)
07: # .kind       : python source
08: # .author     : Fabrizio Pollastri
09: # .site       : Revello - Italy
10: # .creation   : 30-May-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: try: # python 2 and 3 compatibility
33:   from Tkinter import *                 # Tk interface
34: except:
35:   from tkinter import *                 # Tk interface
36:
37: from avc import *                       # AVC
38:
39: TCL_FILE = 'tk_spinbox.tcl'             # GUI description as tcl script
40:
41:
42: class Example(AVC):
43:   """
44:   A spin box whose value is replicated into a label
45:   """
46:
47:   def __init__(self):
48:
49:
50:
51:     # create GUI
52:     self.root = Tk()
53:     self.root.eval('set argc {}; set argv {}; proc ::main {argc argv} {};')
54:     self.root.tk.evalfile(TCL_FILE)
55:
56:     # terminate program at toplevel window destroy: connect toplevel
57:     # destroy signal to termination handler.
58:     self.root.bind_class('Toplevel','<Destroy>',lambda event: self.root.quit())
59:
60:     # the variable holding the spin control value
61:     self.spin_value = 0
62:
63:
64: #### MAIN
65:
66: example = Example()                     # instantiate the application
67: example.avc_init()                      # connect widgets with variables
68: mainloop()                              # run Tk event loop until quit
69:
70: #### END
71: 
Source code: programmatic version (file tk_spinbox_progui.py)
01: #!/usr/bin/python
02: # .+
03: #
04: # .identifier : $Id:$
05: # .context    : Application View Controller
06: # .title      : A spin control replicated into a text label (Tk)
07: # .kind       : python source
08: # .author     : Fabrizio Pollastri
09: # .site       : Revello - Italy
10: # .creation   : 1-Jun-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: try: # python 2 and 3 compatibility
33:   from Tkinter import *                 # Tk interface
34: except:
35:   from tkinter import *                 # Tk interface
36:
37: from avc import *                       # AVC for Tk
38:
39:
40: class Example(AVC):
41:   """
42:   A spin box whose value is replicated into a label
43:   """
44:
45:   def __init__(self):
46:
47:     ## create GUI
48:
49:     # main window
50:     self.root = Tk()
51:     self.root.title('AVC Tk spin box example')
52:     self.frame = Frame(self.root,name='frame')
53:     self.frame.pack()
54:
55:     # label replicating the spin box value
56:     self.label = Label(self.frame,name='spin_value__label',width=16,height=3)
57:     self.label.pack(side=LEFT)
58:
59:     # spin box
60:     self.spinbox = Spinbox(self.frame,name='spin_value__spinbox',
61:       increment=1.0,to=100)
62:     self.spinbox.pack(side=RIGHT)
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: mainloop()                              # run Tk event loop until quit
74:
75: #### END
76: