Introduction ========================= PAGE is a tool which helps in the creation of Python GUI interfaces using Tkinter and the Tk/ttk widget set. It is a fork or extension of the program Visual Tcl (vTcl) which now produces Python code. PAGE runs on any system with Python installed and the generated Python code requires only Python to execute. Faced with the problem of building a GUI for an application, users will find that PAGE facilitates designing that GUI and building a working skeletal Python program utilizing the Tk/ttk widget set. As of version 7, PAGE supports the design and construction of GUI's with multiple toplevel windows. See :ref:`Applications with Multiple Top-Level Windows`. Also, PAGE supports design rework to a limited extent. Version 7 is much simpler while supporting expanded functionality compared to earlier versions. PAGE is aimed at a use who wants to rapidly construct a GUI and is willing to accept the limitations of Tk and the Place Geometry Manager. It is a helper tool. It does not build an entire application but rather is aimed at designing and implementing GUI windows. It is not a Python Interactive Design Environment (IDE). Stated in other words, PAGE generates Python classes which implement GUI windows and also supplies all of the boiler-plate code for execution or instantiation of the GUI objects. If, like me, you have difficulty remembering all the little tricks of getting a GUI to actually appear on the screen, PAGE can show you code that will work. .. When I first set about building programs that exploited Tkinter, I .. could not find nearly enough examples. Another way of looking at PAGE .. is to consider it to be a Tkinter example builder which can build the .. examples you need to see. It is a good place to start when starting .. with Tkinter. The author is Donald Rozenberg and the project page for PAGE is http://page.sourceforge.net/. My email address is Don dot Rozenberg at gmail dot com. Note that some of the screen shots in this documentation may appear with a gray or a wheat background. The reason is that the Tk default color is gray but I prefer wheat. Also, the font size is often large because I prefer, nay require large fonts. Change History ~~~~~~~~~~~~~~ .. include:: The 8.0 is a major release providing: + A first attempt to support ttk themes, but with my tweaks. See :ref:`v8`. + Several themes coordinated with PAGE theme support. + Support for copy-paste of menubars from lender project to current project. + Improved support popup menus including copy-and-paste. + Ability to change locations of notebook tabs. There are known issues with menu editing that will be addressed in a future release. The 7.6 release: + Adds support for vertical progress bars. + Improves behavior Attribute Editor resizing. + Changes popup (context) menus from root widgets to toplevel widgets. + Extends Tooltip support to allow user specify attribute changes from within the support module. + Corrects some issues with Menu Editor. + Corrects an issue with the borrow facility. The 7.5 release: + Moves some boiler plate code from the toplevel class definitions to the module level. + Adds function to Widget Tree allowing collapse and expansion of container widgets. See :ref:`compress`. + Changes the code generation for GUI images so that generated GUI modules can be executed from arbitrary directories. See :ref:`images`. + Corrects problems with paned window widget. + Improves menu processing. + Makes minor corrections to color handling. + Changes skeletal callback functions to make the output more readable. + Adds a couple of color utilities to help with choosing colors. See :ref:`color_utilities`. The 7.4 release: + Cleans up color handling and can lead to a "Dark" mode for PAGE. See :ref:`dark`. + Supports the location of rc files to be in any writable directory. See :ref:`rc`. + Added some capability to modify global colors when reopening existing projects. See :ref:`reopen_colors`. + Includes a new example which shows all of the supported widgets and shows some useful tips. See :ref:`widgetdemo`. The 7.3 release consists mostly of bug fixes. The 7.2 release: + Corrects bugs related to the textvariable option with ttk widgets. Requires the user to disregard "::" artifact in Attribute Editor. + Disallows the closing of the Widget Tree by the user. + Now supports a variety of graphical formats including JPEG for most architectures and OS's. + Uses tk widgets, in place of ttk widgets for dialogues. + Corrects bugs in the update functions. + Corrects bug with selecting TLabel widgets. + Supports selection with Double-Button-1 in Widget Tree. See :ref:`wt_double`. + Implements a search function in Widget Tree. See :ref:`wt_search`. The 7.1 release: + Improves behavior of Attribute Editor. + Corrects bug that prevented creation of popup menus. The 7.0 release is a major release: + Utilizes new formats for the generated GUI module and the support module which are simpler particulary for multiple toplevel GUI's. See :ref:`mod_struct`, :ref:`Applications with Multiple Top-Level Windows`, and :ref:`auto_update`. However the new formats present some backward compatibility questions with existing support modules; see :ref:`compat7`. + Changes code for the skeletal callback functions. + Drops Python 2 support. + Updates examples to version 7. + Updates and substantially enlarges the tutorials. + Includes a discussion on migrating projects created in earlier versions of PAGE. + Improves presentation of attribute errors. + Allows user defined names for context menu function names. + Corrects code for using images. + Corrects code in notebook editor. + Improves the handling of text and textvariable interactions. See :ref:`interact`, and :ref:`ae`. + Adds support for the ttk::spinbox widget. + Modifies the copy-paste to behave more naturally when borrowing toplevel windows. See :ref:`borrow`. + Corrects problems with copy-paste of toplevel menubars and context menus. + Modifies the Widget Tree to behave more naturally when borrowing. + Relegates backup files to the "backups" subdirectoy of project directory. + Adds a preference to add custom sizes to the font selection dialog. + Provides support for the labelanchor attribute with labelframe widgets. + Provides support for inclusion of the post command for the ttk::combobox. + Fixes miscellaneous bugs. The 6.2 release fixes some bugs. The 6.1 release: + Implements an auto-save feature. See :ref:`auto_save`. + Invocation accepts a nonexistent project name. See :ref:`preferred invocation `. + Expands the documentation to discuss :ref:`setting command preferences`. + Better handles specification of validation attributes. + Better handles remembering of PAGE window geometry. + Fixes some bugs. The 6.0 release: + employs a Python wrapper which leads to a much simpler installation process, + improves the error handling and display of PAGE errors, + puts install directory in users PATH for Windows users, + sets working directory of Windows icon to the users Desktop. The 5.6 release: + fixes a problem with code generation with respect to notebook widgets. + fixes a problem with the Attribute Editor in Windows. The 5.5 release: + fixes a problem with aliases in copy-and-paste operations, + adds the capability to revert to default geometries for the principle PAGE windows, see :ref:`newmenu`, + fixes problems with opening and saving projects, + fixes a problem the Absolute/Relative code, + makes minor improvement in the handling of fonts, + reworks some of the examples for better presentation across OS's. The 5.4 release: + changes the Menu Editor to more closely align with Tk menu capabilities. See :ref:`menu`. + fixes a problem with font preferences. + adds the Scrolledspinbox widget. The 5.3 release: + fixes the use of arrow keys and extends their usage to changing sashes in paned windows, + corrects some problems with paned windows, + simplifies the specification of command attributes with arguments by generating lambda functions in some simple cases, See :ref:`section on command linkage`. + includes minor changes to the menu editor. The 5.2 release: + fixes the saving of font specification for scrolled widgets, + modifies the tooltip support to allow changes from inside the support module. See :ref:`balloon`, + expands again the functions available in multiple selection. See :ref:`multiselection`, + improves undo. See :ref:`undo`. The 5.1 release: + extends function available in multiple selection. See :ref:`multiselection`, + changes the key commands for removing multiple selection designation, + provides an experimental undo capability for certain operations. See :ref:`undo`., + handles Windows device letters better, + improve the resizing of panes in paned windows. The 5.0.3 release fixes bugs with relative placement and multiple selection. The 5.0.2 release fixes a busy cursor bug. The 5.0.1 release repairs a mistake in the release of 5.0 documentation. The 5.0 release: + contains rewrite of the support module update code, + fixes problem with aliases of multiple instances of scrolled and custom widgets, + adds facility for removing an image from a widget, + provides limited functionality for multiple widget selection. See :ref:`multiselection`, + adds the Scrolledwindow widget based on the canvas widget. See :ref:`scrolledwindow`, + adds New command to File menu in main menu, + extends relative placement to the design phase of GUI development providing a WYSIWYG improvement. See :ref:`relative`, + corrects some problems with Pane window widgets, + changes the way values are specified for Ttk Combobox widgets. See :ref:`combo`, + improves automatic project saving upon Python generation, + improves support for copy-and-paste, + adds the busy cursor for some long running operations, + moves the python3 examples to the "examples" subdirectory and the previous python2 examples have been moved to the "examples-py2" subdirectory. Python2 examples are no longer being maintained. The 4.26 release: + generates new code for several geometric attributes of toplevel widgets. + changes the invocation option "|minus|\ s" to "|minus|\ |minus|\ s", and removes the "|minus|\ h" option. Also add new option "|minus|\ |minus|\ s". See :ref:`rc`. + changes validation specification and code. See :ref:`Validation commands `. + corrects problem with color of widget handles. + corrects problem with resizing notebook widgets. See :ref:`Resizing Notebook Widgets `. + improves Attribute Editor by not displaying attributes that are not changeable. + tentively explores the ttkwidgets package. See :ref:`ttkwidgets`. + corrects several problems with menu generation and saving. The 4.25.1 release fixes a bug affecting the Python generation for a number of ttk widgets when project have not been saved and reopened before generation of GUI module code. The 4.25 release + makes operation on 32 bit Windows system a whole lot better. + enables the opening of project files on drives different from the current drive, + improves the "Stash and Apply" to facilitate widget alignment, + changes the preferences function has to allow the saving of preferences to a named file. + and fixes several bugs. The 4.24 release includes further corrections for widget images, and font specification. It also facilitates the use of multiple initialization files. See :ref:`rc`. The 4.23a release fixes error that prevents code generation. The 4.23 release fixes several bugs, one related to the Scrolledtreeview, another to code generation in the absence of an IDE specification, and one related to changing relative size attributes in the Attribute Editor. In addition, some aspects of image use has been improved. The font support revealed errors and had to be fixed. Finally, the encoding problems and internationalization was addressed. The 4.22 release fixes several bugs. The 4.21 release includes Balloon Help (tooltips) for many of the supported widgets and bug fixes. The 4.20 release fixes bugs related to the Scale widget and the Scrolledtreeview widget. The 4.19 release: + provides Stash and Apply mechanism for transferring attributes from one widget to others, + enables context menus in the Attribute Editor for transferring attributes from one widget to others - :ref:`see the Attribute Editor `, + further enhances scrolling of PAGE windows, + fixes bugs, some related to color preferences, The 4.18 release: + enhances the Scrolled widgets to support mousewheel scrolling over data windows in generated Python modules, + enhances mousewheel scrolling over PAGE data windows, + removed some warning messages and added other more meaningful ones, + improves the style of the tkinter import statements (see :ref:`naming`), + adds line numbering to the Python consoles, + adds Top button to several PAGE windows, ... .. + enables the context menu for Attribute Editor, The 4.17 release: displays the locked state of a widget in the Attribute Editor, adds a preference for setting the indentation, expands tabs when updating the support module, fixes a subtle bug with placement within labelframe widgets, and enhances the use of geometric attributes in the Attribute Editor. The 4.16 release fixes an important bug in the support module update feature as well as improving the "Fill Container" function. The 4.15 release improves the use of the Binding Window, improves the display of callback functions, and the automatic saving of the project file. The ttk::separator widget is added and support of custom widgets expanded. Individual widget geometries can now be locked to prevent mouse changes. The 4.14 release provides function to save the Widget Tree to a file and function to display callback functions. Fixes are also made for copy and paste as well as to relative placement. The 4.13 release adds a search function to the Python Consols, fixes a syntax coloring problem, adds additional support for utf-8 encoding, and fixes some bugs. The 4.12 release fixes several bugs related to placement, cut and paste, and borrowing. The 4.11 release allows one to copy a menu bar from an existing project to the current project. An important addition is the inclusion of a tutorial written by Greg Walters. The 4.10 release includes a reuse facility which allows one to copy from existing projects and paste to the current project. This release also modifies the startup to automatically create the Toplevel widget and expands support for the Canvas widget and adds some checking of identifier syntax. In addition, there is a new custom version of the TNotebook widget which incorporates an icon for closing tabs. Installation ~~~~~~~~~~~~ **With PAGE 6.0, the way PAGE is installed and invoked has changed.** Installation is much simpler than before and avoids the need to separately install Tcl/Tk. In essence, PAGE uses a Python wrapper, that is a minimal Python module which invokes PAGE which remains a Tcl script. The advantage of the new approach is simplicity of installation. There is no longer a need to install Tcl/Tk. The primary disadvantage I see is that the Tcl/Tk included with Tkinter does not support jpeg images. See :ref:`images`. While that support can easily be added to Linux installations, I have not found a way to added additional image support to Windows. **With PAGE 7.0 PAGE ceases to cater to Python 2.** The required packages for executing PAGE are: * PAGE 7 or greater - This is the GUI generator. Actually one should be using the latest version. * I recommend Python 3.6 or greater. The latest version is a good idea. The packages required for executing the python code generated by PAGE are: * The generated Python modules will execute under Python 3. One does not require PAGE to execute programs containing GUI's generated by PAGE. All that is necessary is a Python version which includes the ttk widgets. The default installation directory is "page" in the users home directory on Unix-like systems. This directory contains the script "page.py", which is executed to invoke PAGE on Unix-like systems. With Windows the default PAGE installation directory is C:\\page. The installation directory contains "page.bat" which invokes PAGE. Installation on Linux --------------------- Untar the distribution file in your home directory. You can probably use 'tar zxvf pageXXX.tgz. This will put all the distribution in the subdirectory "page". Run the configure script. .. sourcecode:: python ./configure Installation on Windows ----------------------- Download page-x.x.x.exe and execute it. This will install PAGE in C:\page. As part of the installation "page.bat" is installed in that directory, page.bat is the analog to the "page" script mentioned above. page.bat is a one line file containing: .. sourcecode:: python @start /min python3 c:\page\page.py %1 %2 %3 This starts PAGE execution from a terminal window. However, **problems have been experienced with the command "python3"**. Sometimes the command needs to be replaced with python. In my case I installed Python 3.10.8 in my Windows 10 system found that python3 would not work but python3.10 would. Unfortunately, there were no error messages. I have no explanation. One can install PAGE in any directory and have the icon start the program. The default directory for installation is C:\\page. .. It was suggested by Pär Smårs that the generation of winpage.bat with .. the correct installation directory should be done magically at .. installation. With version 4.8.7, I managed to do this. Since I have .. a deficient understanding of the Windows world, I decline trying to .. update the PATH environmental variable. The installation directory is automatically added to the Path environmental variable at installation. Thus "page" will invoke the program from any directory. The Shortcut icon will use the users Desktop folder as the working directory. Installation on OS X -------------------- I have not done much with PAGE on OS X. However, several users, including Kent Fox, have tried PAGE on OS X and have convinced me that I should try to support PAGE on that system. However, the implementation of ttk with respect to color on OS X doesn't seem very satisfactory to me so I recommend sticking with default colors. #. Download page-7.x.x.tgz #. Double click on it to expand the zip file. #. Move the page folder to your home directory. .. _rc: Initializing and Executing PAGE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **It is important that the current directory is the development directory for the application when PAGE is started.** A number of users have experienced difficulties because they started PAGE without being in the development directory. Please visit the directory "How To Start PAGE" in page/docs for Greg Walters discussion of our recommended startup procedure. One executes PAGE in Unix-like systems, Linux, OS X, SunOS, etc., by issuing the "python3 page.py" command in the installation directory. Running "./configure" in the installation directory creates an executable file "page" in the installation directory. One can then create a shell alias like: .. sourcecode:: python alias page="~/page/page" Without running configure, you can create a shell alias such as: .. sourcecode:: python alias page="python3 ~/page/page.py" Either way, you can execute "page" in any directory. Be aware that Linux system may have a completely different command with the name “page”. If you issue the command “page” and strange things happen check to be sure you know if our page was executed. Initialization rc Files ----------------------- Associated with the execution of PAGE is an initialization file sometimes called an rc file. It contains the initial configuration, i.e. color schemes, font preferences, window locations, the Python command name, and many other initial values. With PAGE the rc file is by default the file ".pagerc" located in the user's home directory. With Linux and UNIX like systems, PAGE determines the home directory from the HOME environmental variable. With Windows, PAGE tries to get the home directory from the HOME environmental variable. If there is no HOME environmental variable, PAGE uses the HOMEDRIVE and HOMEPATH variables. There are times when one wishes to have multiple initial configurations which are facilitated by having multiple rc files. With version 7.4, rc files are not restricted to the users home directory. For instance, if one wish to have a particular color scheme for a particular PAGE product, he/she may create a custom rc file in the associated project directory. You create a custom rc file by opening PAGE, selecting Preferences from the main menu, and saving the modified preferences wherever you like. The name of the new rc file may be any legal file name, but if you forgo the character "." and end with "rc", the -s argument below will work more satisfactorily. The command for executing PAGE is: .. sourcecode:: python usage: page [