Pave, sort of geometry manager

The apave v4.3.4 package provides a sort of geometry manager for Tcl/Tk.

The apave isn't designed to replace the existing Tk geometry managers (grid, pack). Rather the apave tries to simplify the window layout by using their best, by means of:

  • joining the power of grid and pack
  • uniting the creation of widgets with their layout (and mostly their configuration)
  • minimizing a coder's efforts at creating / modifying / removing widgets
  • setting a natural tab order of widgets
  • theming both ttk and non-ttk widgets
  • centralizing things like icons or popup menus
  • providing mega-attributes, right up to the user-defined ones
  • providing mega-widgets

The apave is implemented as APave oo::class, so that you can enhance it with your own inherited / mixin-ed class.

While APave oo::class allows to layout highly sophisticated windows, its descendants can be used as well.

APaveDialog oo::class and APaveInput oo::class allow you:

  • to call a variety of dialogs, optionally using a "Don't show again" checkbox and a tagged text
  • to use a variety of widgets in dialogs, with entry, text, combobox, file content combobox, spinbox, listbox, file listbox, tablelist, option cascade, checkbutton, radiobutton, label, title label
  • to resize windows neatly (however strange, not done in Tk standard dialogs)

Moreover, instead of APave, it's recommended to use APaveInput objects because they provide most of apave functionality.

The theming facility of apave is enabled by ObjectTheming oo::class which embraces both ttk and non-ttk widgets.

At last, a stand-alone dialog allows not only to ask "OK/Cancel" or "Yes/No" returning 1/0 but also to set environment variables to use in shell scripts.

Along with standard widgets, the mentioned apave classes provide a batch of following mega-widgets:

  • file picker
  • saved file picker
  • directory picker
  • font picker
  • color picker
  • date picker
  • calendar
  • menubar
  • toolbar
  • statusbar
  • file combobox
  • file listbox
  • file viewer/editor
  • option cascade
  • e_menu
  • bartabs
  • baltip
  • gutter
  • link
  • scrolled frame
  • switch
  • user widgets

Note that bartabs, baltip and hl_tcl are contained in apave package as sort of subpackages and can be used independently.

On the other hand, having installed apave, you need not to install bartabs, baltip and hl_tcl.

There is one pitfall at this: if you use Magicsplat or BAWT Tcl/Tk distribution, you can find that they are including a bit obsolete version of apave or one of its subpackages. Or their versions aren't what you rely on. In this case, you should dismiss the preinstalled packages and likely use source for the main script of the package (apaveinput.tcl for apave), this way:

  foreach _ {apave baltip bartabs hl_tcl} {
    catch {
      package forget $_
      namespace delete ::$_
  unset -nocomplain _
  source ./apave/apaveinput.tcl

Also, apave provides a bundle of nice little things like:

  • button / label with a bound command to fire after a timeout
  • progress form for a boot process presumably long
  • blinking widgets to draw attention
  • default context menus for entries and texts, incl. read-only ones
  • configurable balloon messages and tooltips
  • tagged texts
  • changing images and links embedded into texts
  • 25 light and 25 dark color schemes, optionally tinted
  • 74 icons (small & large) for a good deal of occasions
  • customized dimensions of Tcl/Tk Unix's file / directory choosers and enhanced color / date choosers
  • integration with e_menu to expand an application's facilities
  • opening dialogues as modal / non-modal, closed / not closed with Escape key
  • simple [pobj Widget] instead of messy .win.fra1.fra2.and_so_on.widget for configurable widgets
  • Hungarian notation for widget names consistently divided into ttk and non-ttk widgets

In fact, apave has been intended for those programmers who (like me) are too lazy in order to dig in the endless interference of grid and pack, the widget pathes and, most dreadful of all, the belated modifications of GUI.

The apave originates from the old pave package, to comply with How to build good packages ("avoid simple, obvious names for your namespace") and a boastful connotation of the author's name. Anyhow, let it be a sort of a-pave.

Further details:

Download links:

Gallery of demos:

alited, a lite editor is totally based on apave package, as seen in these alited v1.6 demos

Below are some screenshots, just to give a glance at this stuff.

PaveMe example

Figure 1. An example described line by line in example of use .

test2_pave.tcl demo

Figure 2. Screenshot of test (test2_pave.tcl).

test2_pave.tcl demo themed

Figure 3. The same as above, just themed.

test2_pave.tcl demo themed

Figure 4. Themed non-ttk widgets.

Jeff Smith 2022-02-09 : Below is an online demo using CloudTk. This demo runs "Pave, sort of geometry manager" in an Alpine Linux Docker Container. It is a 29.8MB image which is made up of Alpine Linux + tclkit + Pave-sort-of-geometry-manager-v3.4.8a3.kit + libx11 + libxft + fontconfig + ttf-linux-libertine + tzdata. It is run under a user account in the Container. The Container is restrictive with permissions for "Other" removed for "execute" and "read" for certain directories.

Jeff Smith 2021-01-21 : Without looking at the code this demo appears to disconnect at times. I think it maybe because when changes occur the Tk app gets "Restarted" and CloudTk disconnects the session if the Tk app disappears.

Please Note : This demo has a run time of 5 minutes.

aplsimple - 2021-01-21 09:37:22

Hi Jeff,

Thanks for your attention, I'm kinda touched.

As for restarting, you could imitate it with this start of test2_pave.tcl:

     test2_pave.tcl 0 14 12 "middle icons"


  • 0 means "Mild dark" color scheme
  • 14 is a font size
  • 12 is an answer to "Restart test?" warning (i.e. "No" + "Don't show again")
  • "middle icons" means an icon set

By the way, this start resolves a problem with color schemes: when CS is set at start, no blinking occurs at switching tabs, resizing etc.

Also, I have to note that test2_pave.tcl is a test & demo, i.e. something preparatory. Hopefully, it would be followed by something real.

Regards, Alex

Jeff Smith 2021-01-22 : Hi Alex, I made the changes as suggested. With the increased font and icon sizes, it may be better to click on the noVNC control bar tab at the side of the iFrame and select "Fullscreen" for viewing this demo.

aplsimple - 2021-01-22 18:08:07

Hi Jeff,

Perhaps, it makes sense to insert tklib0.6/widget/calendar.tcl (or tklib0.6/widget or entire tklib0.6) into the image and maybe into other ones. Otherwise, at least in this specific demo, the date picker isn't called.

I've updated to disable all of "Restart" options when started from CloudTk. Hopefully it will work.

The "Mild dark" color scheme (0 in the above example) may seem too dark/gloomy for Australian, nay, for anyone. If so, you might try a light CS, e.g. Sandy (12), Florid (19), LightGreen (20), TKE-YellowStone (28)... After all, it's your kingdom of CloudTk and you are the king, not?

The Fullscreen mode runs like a dream :)

Jeff Smith 2021-01-27 : Calendar is now working but may not appear as expected due to the "matchbox window manager". Also the clocks are displaying correctly with the inclusion of the "tzdata" package in the Alpine Linux Docker Container. Now running apave v3.2.8.

MHo 2021-04-10: Tried this code (slighty modified from the example):

set auto_path [linsert $auto_path 0 .]
console show
package require apave
apave::APave create pave
set win .win
pave makeWindow $win.fra "Find and Replace"
set v1 [set v2 1]
set c1 [set c2 [set c3 0]]
set en1 [set en2 ""]
pave paveWindow $win.fra {
  {lab1 - - 1 1    {-st es}  {-t "Find: "}}
  {ent1 lab1 L 1 9 {-st wes} {-tvar ::en1}}
  {lab2 lab1 T 1 1 {-st es}  {-t "Replace: "}}
  {ent2 lab2 L 1 9 {-st wes} {-tvar ::en2}}
  {labm lab2 T 1 1 {-st es} {-t "Match: "}}
  {radA labm L 1 1 {-st ws} {-t "Exact" -var ::v1 -value 1}}
  {radB radA L 1 1 {-st ws} {-t "Glob" -var ::v1 -value 2}}
  {radC radB L 1 1 {-st es} {-t "RE  " -var ::v1 -value 3}}
  {h_2 radC L 1 2  {-cw 1}}
  {h_3 labm T 1 9  {-st es -rw 1}}
  {seh  h_3 T 1 9  {-st ews}}
  {chb1 seh  T 1 2 {-st w} {-t "Match whole word only" -var ::c1}}
  {chb2 chb1 T 1 2 {-st w} {-t "Match case"  -var ::c2}}
  {chb3 chb2 T 1 2 {-st w} {-t "Wrap around" -var ::c3}}
  {sev1 chb1 L 3 1 }
  {lab3 sev1 L 1 2 {-st w} {-t "Direction:"}}
  {rad1 lab3 T 1 1 {-st we} {-t "Down" -var ::v2 -value 1}}
  {rad2 rad1 L 1 1 {-st we} {-t "Up"   -var ::v2 -value 2}}
  {sev2 ent1 L 8 1 }
  {but1 sev2 L 1 1 {-st we} {-t "Find" -com "::pave res $win 1"}}
  {but2 but1 T 1 1 {-st we} {-t "Find All" -com "::pave res $win 2"}}
  {but3 but2 T 1 1 {-st we} {-t "Replace"  -com "::pave res $win 3"}}
  {but4 but3 T 1 1 {-st nwe} {-t "Replace All" -com "::pave res $win 4"}}
  {seh3 but4 T 1 1 {-st ewn}}
  {but5 seh3 T 3 1 {-st we} {-t "Close" -com "::pave res $win 0"}}
set res [pave showModal $win -focus $win.fra.ent1 -geometry +200+200]
puts "
pave destroy
tk_messageBox -message "Fertig"

If I click on any on the buttons to the right, the following error occurs:

invalid command name "::oo::Obj56::WinResize"
    while executing
"::oo::Obj56::WinResize .win"
    (command bound to event)

What am I doing wrong?

aplsimple 2021-10-06:

APave object doesn't ever destroy windows. At destroying the APave object, its window event handlers are destroyed too. But the window still remains and tk_messageBox runs event processing cycle, hence the error.

I.e. your test should be:

pave destroy
destroy $win
tk_messageBox -message "Fertig"

Two reasons for this: 1) you can insert some code between "pave destroy" and "destroy $win" (so that the window would be seen while executing the code) 2) you can destroy only a window and use the pave object for paving other windows.