If you're running Openbox and want to create a simple graphical window with buttons, the lightest and simplest options are typically scripting
languages with built-in GUI capabilities. Here are some of the lightest and easiest options:
### 1. **Python with Tkinter**
Tkinter is the standard GUI toolkit for Python and is included with Python installations. It's lightweight and easy to use for simple windows and
buttons.
#### Example:
```python
import tkinter as tk
def button_click():
print("Button clicked!")
root = tk.Tk()
root.title("Simple Window")
button = tk.Button(root, text="Click Me", command=button_click)
button.pack(padx=20, pady=20)
root.mainloop()
```
#### Pros:
- Very lightweight.
- Easy to learn and use.
- Cross-platform.
#### Cons:
- The look and feel might not be as modern as other toolkits.
### 2. **Python with PyGTK (GTK)**
GTK is a bit more modern than Tkinter and is widely used in Linux. PyGTK is the Python binding for GTK.
#### Example:
```python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
def button_click(button):
print("Button clicked!")
win = Gtk.Window(title="Simple Window")
win.connect("destroy", Gtk.main_quit)
win.set_default_size(200, 100)
button = Gtk.Button(label="Click Me")
button.connect("clicked", button_click)
win.add(button)
win.show_all()
Gtk.main()
```
#### Pros:
- More modern look and feel.
- Widely used in Linux.
#### Cons:
- Slightly more complex than Tkinter.
### 3. **Bash with Zenity or Yad**
For the absolute simplest solution, you can use `zenity` or `yad` (Yet Another Dialog), which are command-line utilities for creating simple
graphical dialogs.
#### Example with Zenity:
```bash
zenity --info --text="Hello, World!" --title="Simple Window"
```
#### Example with Yad (more features):
```bash
yad --title="Simple Window" --button="Click Me" --text="Hello, World!"
```
#### Pros:
- Extremely lightweight.
- No need to write a script, just use command-line options.
#### Cons:
- Limited functionality compared to full GUI toolkits.
### 4. **Lua with LÖVE (Love2D)**
If you want something a bit more flexible and game-like, you can use Lua with the LÖVE framework.
#### Example:
```lua
function love.load()
love.window.setTitle("Simple Window")
love.graphics.setBackgroundColor(1, 1, 1)
button = {x = 100, y = 100, width = 100, height = 40, text = "Click Me"}
end
function love.draw()
love.graphics.setColor(0.5, 0.5, 1)
love.graphics.rectangle("fill", button.x, button.y, button.width, button.height)
love.graphics.setColor(1, 1, 1)
love.graphics.print(button.text, button.x + 30, button.y + 10)
end
function love.mousepressed(x, y, button)
if button == 1 and x >= button.x and x <= button.x + button.width and y >= button.y and y <= button.y + button.height then
print("Button clicked!")
end
end
```
#### Pros:
- Flexible and powerful.
- Good for simple games or interactive applications.
#### Cons:
- More complex setup compared to Tkinter or Zenity.
### Conclusion
For the simplest and lightest solution, **Python with Tkinter** or **Bash with Zenity/Yad** are your best options. If you need something more
modern, **Python with PyGTK** is a good choice. If you're looking for something more flexible and game-like, **Lua with LÖVE** is worth considering