exec_decision_maker.py

Created by vnap0v

Created on September 01, 2025

1.17 KB

EXECUTIVE DECISION MAKER

This script is inspired on a device Radio Shack used to sell. Meant as a joke it generates random “executive decisions”.

A bit of animation is build in.

The script uses the following libraries:

  • kandinsky for drawing and text positioning
  • ion to react on key press
  • time to time the simple animations
  • random to generate the random decisions


import kandinsky,random,time,ion

# define decision text and coordinates
options=(("DEFINITELY",30,60),
         ("ASK AGAIN",190,60),
         ("NEVER",30,90),
         ("FORGET IT",190,90),
         ("WHY NOT",30,120),
         ("POSSIBLY",190,120))
# draw the fixed text
def draw_text():
  kandinsky.fill_rect(0,0,320,240,"white")
  kandinsky.draw_string("EXECUTIVE DECISION MAKER",40,10,"black")
  kandinsky.draw_string("Press <Exe> to make decision",20,180,"black")

# draw options with 
# one highlighted
def draw_options(chosen):
  for index, option in enumerate(options):
    txt, x, y = option
    col = "red" if index == chosen else "black"
    kandinsky.fill_rect(x-8,y-3,115,25,col)
    kandinsky.draw_string(txt,x,y,"white",col)

# make a decisions with 
# some animation
def random_action():
  # random switching
  for _ in range(15):
    n=random.randrange(0,6)
    draw_options(n)
    time.sleep(0.2)
  # make chosen decsion
  # flicker for a while
  for _ in range(5):
    draw_options(7)
    time.sleep(0.1)
    draw_options(n)
    time.sleep(0.1)    
  return n

draw_text()
draw_options(7)
while True:
  if ion.keydown(ion.KEY_EXE):
    random_action()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.