static-sites/bases/do-blog/resources/documents/python/gtk3/tutorial2.py

40 lines
1.4 KiB
Python
Executable File

#+BEGIN_COMMENT
.. title: Adding GTK-3 buttons and switches
.. slug: 02-adding-buttons-and-switches
.. date: 2014-01-08 12:00:00 UTC
.. tags: GTK-3, python, glade
.. category: python
.. description: GTK Example on click and toggle buttons connect to there events to run code when activated by the user.
.. type: text
#+END_COMMENT
#+CAPTION: Display GTK-3 Buttons and switches
[[../../../images/gtk/tut02-buttons.png]]
class page:
name=__name__
title = ''
tags = 'GTK3', 'Python', 'window', 'button', 'toggle'
intro = 'GTK Example on click and toggle buttons connect to there events to run code when activated by the user.'
date = '2014-01-08'
path = os.path.abspath('./')
image = web.template.path_image + '/gtk/tut02-buttons.png'
def create_content(self):
web.images.create(self.image, title='GTK Window')
web.page.section(
web.div.create(
web.images.render()
).set_classes('sources').render()
)
web.paragraph.create(
"""The example below loads 4 buttons from a glade 2 standard and 2 toggle buttons, it then connects event handles to show some text when clicked or to show the toggle state if a toggle button was clicked.""")
web.page.section(web.paragraph.render())
web.pre.create(load(os.path.abspath('./content/gtk3/tut02/tut02-buttons.py')))
web.page.section(web.pre.render())