Pie Menu Implementations

Pie Menus for OLPC Sugar User Interface, in Python with GTK, Cairo and Pango modules.

Pie Menus on Python/GTK/Cairo for OLPC Sugar, by Don Hopkins.

Python Source Code

Tar File with Source, Demos and Icons.

Demos of Pie Menus for OLPC (One Laptop Per Child) Sugar User Interface on XO Laptop

I've been doing some fun OLPC user interface programming in Python. The OLPC's open source software environment includes Linux (for operating), Python (for scripting), GTK (for widgets), Cairo (for structured/stencil/paint/outline graphics) and Pango (for formatted text with markup), and it totally rocks!

Four item pie menu with submenus:

Pop up the "Compass" pie submenu, which has eight pie items and three linear overflow items and select "NE". These menus support pure pie menus, pure linear menus, and hybrid pie/linear menus. They can limit the number of pie items to a convenient number like 8, and make the rest linear items.

Pop up a ridiculously complex "Ringed" pie submenu, which has four rings of items, the inner ring with only four, which are very easy to select, the next ring with eight, which are easy to select because they're further out, the next ring with 24, and the next ring with a bunch more, which are harder but possible to select. This is the ultimate stress test of ringed pie menus. (Well actually there is no limit to the number of rings, but too many rings and menu items may result in heavy, unstable, radioactive pie menus!)

Example SimCity Pie Menus

To demonstrate how icons can work together with help text in the footer, I've made a set of example pie menus for selecting SimCity editing tools (based on the graphics and layout of the old X11/TCL/Tk SimCity interface), in simcity_piemenus.py. Note: They do not actually do anything -- it's just a simulated simulation!

SimCity tool selection menu, with two submenus ("Zone..." and "Build..."), and six important quickly selectable editing tool items. Shows icons without labels, and descriptive help text in the footers.

SimCity Zone pie submenu. Six items for zoning residential, commercial and industrial, fire stations, police stations, and querying zones.

SimCity Build pie submenu. Six items for building parks, stadiums, seaports, coal power plants, nuclear power plants, and airports.

Pie Menus for NeWS 1.1 - March 1988

I release the first version of pie menus for NeWS 1.1 on March 30, 1988. Here is the source code written in NeWS's dialect of PostScript with Owen Densmore's object oriented extensions, using the "Lite" user interface toolkit.

Date: Wed, 30 Mar 88 08:02:23 EST
From: Don Hopkins <don@brillig.umd.edu>
To: NeWS-makers@brillig.umd.edu
Subject: Pie Menus for NeWS 1.1

Here's the latest piemenu.ps, for NeWS 1.1! You can psh it into your NeWS server, or load it from your user.ps. Note that because of a problem with /flipstyle, you should load piemenu.ps after customizing the NeWS rootmenu and its submenus. This is because flipstyle changes the submenu objects under rootmenu, but not the variables in systemdict that refer to them. The function /setdefaultmenu, defined and invoked in piemenu.ps, sends a /flipstyle to roomenu and redefines the rootmenu in systemdict. If you want to change the menus after running piemenu.ps, one fix for this problem is to use /searchkey in your user.ps, after running piemenu.ps, to redefine the variables in systemdict to refer to the new submenus. Then you can send /insertitem and /deleteitem messages to terminalmenu, etc. (Otherwise you'd be changing the old submenus, and see no effect on the pie submenus.)

Mark Weiser's Pie Menus for Suntools - January 1987

While snowed in with his Sun workstation at home during January 1987, Mark Weiser implemented pie menus for Sunview. He used the Sunview pie menus for his classic "SDI" game.

Date: Fri, 23 Jan 87 20:12:37 EST
From: mark@markssun.cs.umd.edu (Mark Weiser)
To: don@mimsy.umd.edu
Subject: pies in sunview

I used the snow to hack pies into sunview. It works now without walking menus. Will have walking over the weekend.

Pie Menus for X10 "uwm" Window Manager - June 1986

My second implementation of pie menus (source code), written in June of 1986, was an extension to the X10 "uwm" window manager.

I refactored "uwm" and integrated it into Mitch Bradley's Sun Forth system, to implement a Forth programmable window manager with pie menus called "pietest" (source code). I reprogramming the window manager's main loop in Forth, to perform an empirical comparison of pie menus with linear menus.

Later, I wrote this generic pie menu layout and tracking code written in C is open source, and may be used as a basis to implement pie menus on other systems. It supports pie menus with any number of items. Each item can be of any positive angular width, as long as all the item widths add up to 360 degrees. Each item records the quadrant and slope of its leading edge. A leading edge is a ray going out from the menu center in the direction given by an item's (quadrant,slope) pair. The area of a pie menu item is the wedge between its leading edge, and the leading edge of the next menu item.

The generic pie menu tracking code is optimized to minimize floating point division and avoid calling atan2 during mouse tracking. But now most computers are much faster and have floating point hardware, so the optimizations are no longer necessary to keep up with the mouse (but they still might be useful on low end computers and small embedded devices).

Theta Menu Test for X10 - June 1986

My first implementation of pie menus was written in June of 1986: a simple proof of concept called "theta menus," written in C for X10 (the window system that preceded X11).

Laszlo Pie Menus

I've ported my JavaScript pie menu code to OpenLaszlo, and rewritten it to take advantage of Laszlo features like Flash graphics and animation, constraints, events, prototype customization, and XML data binding.

I'm using the Laszlo pie menus in the Sims Content Catalog, and the von Neumann 29 State Cellular Automata, and other projects.

Laszlo Pie Menu Demo

Laszlo Pie Menu Demo Source Code in Laszlo

Laszlo Pie Menu Component Source Code in Laszlo

XML Pie Menus

Chris, a computer science student from digipen.edu who's interested in user interface design, asked me some interesting questions about pie menus:

First, were you happy with The Sims' implementation of pie menus? It seems as though it doesn't necessarily provide all of the great features of an ideal pie. The targets aren't infinitely 'deep' -- the user needs to click directly on the button. Perhaps more importantly, the targets aren't in predictable locations (they items are dynamic based on a very complex set of inputs.) Don't misunderstand; I loved the game and felt the the interface worked well. I am interested in the design decisions that were made.

The other thing I wanted ato ask was, have you any opinions on the game Sacrifice? I was very drawn to its pie system, and am always surprised that there has really never been much mention of it when it comes to discussion of pies, and pies in games. Thank you for your time,


Thanks for your thoughtful questions!

I'm glad to hear fasteroids still works after all those internet explorer patches that have come out since I wrote it. I hope the Eloas patent doesn't force Microsoft to break browser plug-ins like fasteroids and pie menus on purpose.

I'm pretty happy with the way The Sims pie menus turned out, considering the time and design constraints. But of course there are several things about them I would change and extend if I had the time.

Syndicate content