GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Source-Code-from-Tutorials/PythonGTK/Examples/04_boxes.py at master · MEDBED/Source-Code-from-Tutorials

Expand file tree

/

04_boxes.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
34 lines (24 loc) · 1.01 KB
/

04_boxes.py

Copy path

File metadata and controls

34 lines (24 loc) · 1.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from gi.repository import Gtk
# create a box (invisible container) with widgets inside
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Boxes are Awesome")
# 6px between children
self.box = Gtk.Box(spacing=6)
self.add(self.box)
# Create two buttons and put them in the box
self.bacon_button = Gtk.Button(label="Bacon")
self.bacon_button.connect("clicked", self.bacon_clicked)
# Pack_start means just position items in box from left to right
self.box.pack_start(self.bacon_button, True, True, 0)
self.tuna_button = Gtk.Button(label="Tuna")
self.tuna_button.connect("clicked", self.tuna_clicked)
self.box.pack_start(self.tuna_button, True, True, 0)
def bacon_clicked(self, widget):
print("You clicked Bacon")
def tuna_clicked(self, widget):
print("You clicked Tuna")
window = MainWindow()
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.