Skip to content

Core Concepts

In a standard Python script, code runs in a straight line from top to bottom. It asks a question, waits for an answer, and exits as soon as it reaches the last line.

Creating a GooeyPie app changes this flow. Instead of a linear script, your program becomes a persistent window - an interactive environment that stays open, listening and waiting for the user to trigger an action.

Whether you are a student or an experienced developer, understanding these four fundamental concepts will help you transition from terminal scripts to graphical apps.

A collection of widgets - labels, an entry, a textbox, a slider, a checkbox, and a button

Everything you see in a GooeyPie app is a Widget. Instead of using print() to show information or input() to get it, you use:

  • Labels to display text.
  • Entries to for single line typing or Textboxes for longer text.
  • Dropdowns, RadioGroups, Listboxes and more for making choices and selections.
  • Buttons for actions.

You create these objects first, then use app.add(widget, column, row) to place them on to the window:

The widgets placed on to an application window

In a GooeyPie window, the interface is organized as a grid system. Every widget is placed at a specific column and row (or (x, y) if you’re feeling mathematically inclined!)

  • Columns go across (1, 2, 3, …)
  • Rows go down (1, 2, 3, …)
The window showing the grid system used by GooeyPie

You can even make widgets “stretch” across multiple columns or rows using column_span and row_span when adding widgets, and you can control their alignment and whether or not they expand to fill the space available.

Information associated with a widget - like the text in an Entry, or the selected item in a RadioGroup - sometimes needs to be accessed, and other times needs to be modified. GooeyPie simplifies this by using properties.

Think of a property like a variable that belongs to a widget. You don’t need a fancy function to change what a label says - you just treat its .text property like a normal variable.

ActionThe “Standard” Way (methods)The GooeyPie Way (properties)
Get Textval = entry.get_text()val = entry.text
Set Textlabel.set_text("Hi")label.text = "Hi"

GooeyPie widgets still have methods for more complex actions, but for the most common tasks, properties make your code cleaner and easier to read. You can get and set values directly without needing to remember specific method names or syntax.

If you’re a beginner, this is an important shift in understanding how a program runs. In a standard Python script, the program finishes once it reaches the last line. In GooeyPie, the program enters an Event Loop.

To set up events in GooeyPie, the process looks like this:

  1. Register the Event: You tell a widget which function to run when something happens using an .on_event method.
  2. The Function: You write a function that handles the work.
  3. The Loop: app.run() starts the engine.

The app stays open, “listening” for clicks, keypresses or changes, and only runs your functions when those events happen.

A mouse clicking a button in the application