<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Python &#187; GUI</title>
	<atom:link href="/python/category/gui/feed/" rel="self" type="application/rss+xml" />
	<link>https://talkera.org/python</link>
	<description>Programming Blog</description>
	<lastBuildDate>Sun, 01 Feb 2015 17:15:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1</generator>
	<item>
		<title>QML and PyQT: Creating a GUI (tutorial)</title>
		<link>https://talkera.org/python/qml-and-pyqt-creating-a-gui-tutorial/</link>
		<comments>https://talkera.org/python/qml-and-pyqt-creating-a-gui-tutorial/#comments</comments>
		<pubDate>Tue, 27 Jan 2015 19:10:24 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[pyqt]]></category>
		<category><![CDATA[QML]]></category>

		<guid isPermaLink="false">https://talkera.org/python/?p=90</guid>
		<description><![CDATA[If you have not done our first PyQT tutorial yet, you should do it, it&#8217;s fun! In this tutorial we will use an user interface markup language, a language that describes the graphical  user interfaces and controls .  An excerpt of user interface markup language code could look like: [crayon-54cf0c7d259d8686145081/] Essentially the language tells what [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you have not done our <a href="/python/building-an-application-gui-with-pyqt-beginners-tutorial/" target="_blank">first PyQT tutorial</a> yet, you should do it, it&#8217;s fun! In this tutorial we will use an user interface markup language, a language that <em>describes the graphical  user interfaces and controls</em> .  An excerpt of user interface markup language code could look like:</p><pre class="crayon-plain-tag">Rectangle {
     id: simplebutton
     color: "grey"
     width: 150; height: 75</pre><p>Essentially the language tells what the interface should look like. The language we will be using is called QML. Do not worry about it for now.</p>
<p>Start a programmed called QTCreator.   The tutorial will be quite graphical to help you through the whole process. Simply type <em>qtcreator</em> in the terminal or start it from the menu list.  This screen should pop up:</p>
<p><a href="/python/wp-content/uploads/2015/01/qtcreator.png"><img class="alignnone wp-image-91 size-full" src="/python/wp-content/uploads/2015/01/qtcreator.png" alt="qtcreator" width="1366" height="743" /></a></p>
<p>Press the big <strong><em>New Project</em> </strong>button. Select<em><strong> QT Quick Application</strong></em> from the menu below. Finally press<em><strong> Choose</strong></em> on the bottom right.</p>
<p><a href="/python/wp-content/uploads/2015/01/qtquick.png"><img class="alignnone wp-image-93 size-full" src="/python/wp-content/uploads/2015/01/qtquick.png" alt="QT Quick Project QML" width="882" height="545" /></a></p>
<p>A new popup will appear:</p>
<p><a href="/python/wp-content/uploads/2015/01/kde-create.png"><img class="alignnone wp-image-95 size-full" src="/python/wp-content/uploads/2015/01/kde-create.png" alt="kde create" width="902" height="475" /></a></p>
<p>Type a name and a valid path to save your project. Then press Next.  Select <em><strong>QT Quick 2.0</strong></em> from the menu list. Press Next. Press Finish. Immediately a user interface defined in the QML language will appear.</p>
<p><a href="/python/wp-content/uploads/2015/01/qtquick2.png"><img class="alignnone size-full wp-image-99" src="/python/wp-content/uploads/2015/01/qtquick2.png" alt="qtquick2" width="711" height="402" /></a></p>
<p>Like all great programmers we are going to solve things the most lazy way possible.  Instead of typing all the QML code by hand we are going to press the <em><strong>Design</strong> </em>button that is on the left of the screen.  A drag and drop screen should appear now.</p>
<p><a href="/python/wp-content/uploads/2015/01/draganddrop.png"><img class="alignnone size-full wp-image-101" src="/python/wp-content/uploads/2015/01/draganddrop.png" alt="QT draganddrop" width="810" height="467" /></a></p>
<p>We drag an image onto the area and select the source on the right. Save the project. Open a terminal and locate the qml file you just created. Alternatively you could simply copy the code in the edit box and save it to a .qml file. Enter the command:</p><pre class="crayon-plain-tag">qmlviewer main.qml</pre><p>This will display the windows as defined in the qml file without any functionality. It is simply a viewer for the interface.  We then create some code to load this QML definition:</p><pre class="crayon-plain-tag">import sys

from PyQt4.QtCore import QDateTime, QObject, QUrl, pyqtSignal
from PyQt4.QtGui import QApplication
from PyQt4.QtDeclarative import QDeclarativeView

app = QApplication(sys.argv)

# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('main.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setGeometry(100, 100, 400, 240)
view.show()

app.exec_()</pre><p>Finally we modify the first line main.qml to:</p><pre class="crayon-plain-tag">import Qt 4.7</pre><p>Simply because our QtQuick was missing. Running</p><pre class="crayon-plain-tag">python run.py</pre><p>Will now display our user interface as defined by QML:</p>
<p><a href="/python/wp-content/uploads/2015/01/QML_PyQT.png"><img class="alignnone size-full wp-image-103" src="/python/wp-content/uploads/2015/01/QML_PyQT.png" alt="QML_PyQT" width="533" height="367" /></a></p>
<p>All of the code is simply PyQT, so you could add code like in the previous tutorial. These are the two methods to create a graphical interface with PyQT.  This method may be more loosely coupled to the code compared to the method of creating a GUI with QT in the previous tutorial. Despite that both are valid methods.</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;linkname=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;linkname=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;linkname=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;linkname=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" title="Reddit" rel="nofollow" target="_blank"></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;linkname=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" title="StumbleUpon" rel="nofollow" target="_blank"></a><a class="a2a_button_pinterest" href="http://www.addtoany.com/add_to/pinterest?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;linkname=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" title="Pinterest" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="https://www.addtoany.com/share_save#url=http%3A%2F%2Ftalkera.org%2Fpython%2Fqml-and-pyqt-creating-a-gui-tutorial%2F&amp;title=QML%20and%20PyQT%3A%20Creating%20a%20GUI%20%28tutorial%29" id="wpa2a_2"></a></p>]]></content:encoded>
			<wfw:commentRss>https://talkera.org/python/qml-and-pyqt-creating-a-gui-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building an application GUI with PyQT, beginners tutorial</title>
		<link>https://talkera.org/python/building-an-application-gui-with-pyqt-beginners-tutorial/</link>
		<comments>https://talkera.org/python/building-an-application-gui-with-pyqt-beginners-tutorial/#comments</comments>
		<pubDate>Mon, 26 Jan 2015 00:29:04 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[pyqt]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">https://talkera.org/python/?p=76</guid>
		<description><![CDATA[In this tutorial we will teach you how to create a graphical application with PyQT.  You will need to install some packages: [crayon-54cf0c7d2781b261515969/] If python-kde4 cannot be found update your repository to find it. If you are on Ubuntu use this link. Now we can use the QT Designer application. It saves us from writing [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we will teach you how to create a graphical application with PyQT.  You will need to install some packages:</p><pre class="crayon-plain-tag">sudo pip install pyqt
sudo apt-get install qt4-designer
sudo apt-get install pyqt4-dev-tools
sudo apt-get install python-kde4</pre><p>If python-kde4 cannot be found update your repository to find it. If you are on Ubuntu use<a href="http://packages.ubuntu.com/precise/i386/python-kde4/download" target="_blank"> this link</a>.</p>
<p>Now we can use the QT Designer application. It saves us from writing tons of layout code that you may be used to when writing HTML.  Start qt4-designer from your applications menu. The QT Designer application will appear:</p>
<div id="attachment_77" style="width: 1376px" class="wp-caption alignnone"><a href="/python/wp-content/uploads/2015/01/QT_Designer.jpg"><img class="wp-image-77 size-full" src="/python/wp-content/uploads/2015/01/QT_Designer.jpg" alt="QT_Designer" width="1366" height="743" /></a><p class="wp-caption-text">QT_Designer</p></div>
<p>Press <em>Dialog without Buttons</em> and press<em> Create</em>. You can now drag any component from the widget box to the form. Simple drag and drop. We added a button, label and a pixmap.  (I took a random image from the web for the pixmap)</p>
<p><a href="/python/wp-content/uploads/2015/01/QT_KDE_Dialog.jpg"><img class="alignnone wp-image-82 size-full" src="/python/wp-content/uploads/2015/01/QT_KDE_Dialog.jpg" alt="QT_KDE_Dialog" width="549" height="259" /></a></p>
<p>Our window looks like the image above. Press Form &gt; Viewcode. We will get a popup box with the form code in&#8230; C++! That is great, but we want the Python code.   Press <em><strong>File &gt; Save as &gt; form.ui</strong></em>.</p>
<p>The file test.ui contains your form described in XML format. (You can view it in a text editor) Open a console and type:</p><pre class="crayon-plain-tag">pyuic4 form.ui &gt; form.py</pre><p>Running the file does nothing. Create a new file called  gui.py</p>
<p>Paste the code below:</p><pre class="crayon-plain-tag">import sys
from PyQt4 import QtCore, QtGui
from form import Ui_Dialog


class MyDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MyDialog()
    myapp.show()
    sys.exit(app.exec_())</pre><p>Run with:</p><pre class="crayon-plain-tag">python gui.py</pre><p>This will open our graphical interface. Pressing on the OK button will simply close the application.</p>
<p><a href="/python/wp-content/uploads/2015/01/pyqt_window.jpg"><img class="alignnone size-medium wp-image-83" src="/python/wp-content/uploads/2015/01/pyqt_window-300x215.jpg" alt="PyQT window" width="300" height="215" /></a></p>
<p>We want to add some action when the OK button is pressed.  We add these three lines to the code:</p><pre class="crayon-plain-tag">self.ui.pushButton.clicked.connect(self.OK)

    def OK(self):
        print 'OK pressed.'</pre><p>Please make sure your button is named pushButton by inspecting the<em> form.py</em> file. Pressing the button will print &#8216;OK pressed&#8217; to the terminal.</p>
<p><a href="/python/wp-content/uploads/2015/01/pyqt_window2.jpg"><img class="alignnone size-medium wp-image-84" src="/python/wp-content/uploads/2015/01/pyqt_window2-300x163.jpg" alt="pyqt_window2" width="300" height="163" /></a></p>
<p>Total application below:</p>
<p><strong>gui.py</strong></p><pre class="crayon-plain-tag">import sys
from PyQt4 import QtCore, QtGui
from form import Ui_Dialog


class MyDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.ui.pushButton.clicked.connect(self.OK)

    def OK(self):
        print 'OK pressed.'


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MyDialog()
    myapp.show()
    sys.exit(app.exec_())</pre><p><strong>form.py (generated):</strong></p><pre class="crayon-plain-tag"># -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'form.ui'
#
# Created: Mon Jan 26 01:18:19 2015
#      by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(325, 208)
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(30, 100, 341, 61))
        self.label.setObjectName(_fromUtf8("label"))
        self.pushButton = QtGui.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(10, 150, 301, 41))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.kpixmapregionselectorwidget = KPixmapRegionSelectorWidget(Dialog)
        self.kpixmapregionselectorwidget.setGeometry(QtCore.QRect(-30, -20, 371, 161))
        self.kpixmapregionselectorwidget.setPixmap(QtGui.QPixmap(_fromUtf8("Desktop/IMG_0377.jpg")))
        self.kpixmapregionselectorwidget.setObjectName(_fromUtf8("kpixmapregionselectorwidget"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
        self.label.setText(_translate("Dialog", "This form is created with Python and QT.", None))
        self.pushButton.setText(_translate("Dialog", "OK", None))

from PyKDE4.kdeui import KPixmapRegionSelectorWidget</pre><p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;linkname=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;linkname=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;linkname=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;linkname=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" title="Reddit" rel="nofollow" target="_blank"></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;linkname=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" title="StumbleUpon" rel="nofollow" target="_blank"></a><a class="a2a_button_pinterest" href="http://www.addtoany.com/add_to/pinterest?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;linkname=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" title="Pinterest" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="https://www.addtoany.com/share_save#url=http%3A%2F%2Ftalkera.org%2Fpython%2Fbuilding-an-application-gui-with-pyqt-beginners-tutorial%2F&amp;title=Building%20an%20application%20GUI%20with%20PyQT%2C%20beginners%20tutorial" id="wpa2a_4"></a></p>]]></content:encoded>
			<wfw:commentRss>https://talkera.org/python/building-an-application-gui-with-pyqt-beginners-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating a gui in Python with WxWidgets [tutorial for beginners]</title>
		<link>https://talkera.org/python/creating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners/</link>
		<comments>https://talkera.org/python/creating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners/#comments</comments>
		<pubDate>Fri, 23 Jan 2015 22:19:10 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[wx]]></category>
		<category><![CDATA[wxpython]]></category>
		<category><![CDATA[wxwidgets]]></category>

		<guid isPermaLink="false">https://talkera.org/python/?p=67</guid>
		<description><![CDATA[Python programming is a lot of fun and sometimes we want to create a graphical application (GUI). WxWidgets can be used to create a graphical interface that looks like a native application on any operating system. First download and install WxPython, the Python bindings for wxWidgets. [crayon-54cf0c7d28c67543546780/] Then install a GUI creator called wxglade: [crayon-54cf0c7d28c82532619933/] [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Python programming is a lot of fun and sometimes we want to create a graphical application (GUI). WxWidgets can be used to create a graphical interface that looks like a native application on any operating system. First download and install WxPython, the Python bindings for wxWidgets.</p><pre class="crayon-plain-tag">sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-doc wx2.8-examples wx2.8-headers wx2.8-i18n</pre><p>Then install a GUI creator called wxglade:</p><pre class="crayon-plain-tag">sudo apt-get install wxglade</pre><p>Using a GUI builder such as wxGlade will save you a lot of time, regardless of the GUI library you use. You can easily make complex graphical interfaces because you can simply drag and drop.</p>
<p><strong>Creating our first GUI with Python and wxWidgets:</strong></p>
<p>Start wxglade. You will see its user interface:</p>
<p><a href="/python/wp-content/uploads/2015/01/wxglade.jpeg"><img class="alignnone size-full wp-image-68" src="/python/wp-content/uploads/2015/01/wxglade.jpeg" alt="wxglade" width="163" height="206" /></a></p>
<p>Press on tiny window on the top left, below the file icon.</p>
<p><a href="/python/wp-content/uploads/2015/01/wxglade2.png"><img class="alignnone size-full wp-image-69" src="/python/wp-content/uploads/2015/01/wxglade2.png" alt="wxglade frame" width="192" height="170" /></a></p>
<p>Press OK.  An empty window will now appear.  Press on the tiny [OK] button in the wxGlade panel and press on the frame. The button will now appear. Press on Application in the tree window.</p>
<p><a href="/python/wp-content/uploads/2015/01/wxglade2.jpg"><img class="alignnone size-medium wp-image-71" src="/python/wp-content/uploads/2015/01/wxglade2-300x300.jpg" alt="wxglade2" width="300" height="300" /></a></p>
<p>Set the output file in the wxproperties window.</p>
<p><a href="/python/wp-content/uploads/2015/01/wxglade3.jpg"><img class="alignnone size-medium wp-image-72" src="/python/wp-content/uploads/2015/01/wxglade3-214x300.jpg" alt="wxglade3" width="214" height="300" /></a></p>
<p>If you look at the window note you can select multiple programming languages and two versions of wxWidgets. Select Python and wxWidgets 2.8.  Finally press Generate code<em><strong>. (Do NOT name the file wx.py because the import needs wx, save it as window.py or something else).</strong></em></p>
<p><strong>Putting it all together:</strong><br />
Run:</p><pre class="crayon-plain-tag">python window.py</pre><p>And a window with a button will appear. Pressing the button will not do anything. To start a function when pressing the button, we need to define a so called Callback. This can be as simple as:</p><pre class="crayon-plain-tag">def OnButton(self, Event, button_label):
        print "In OnButton:", button_label</pre><p>Finally we bind the button to the callback function using:</p><pre class="crayon-plain-tag">self.button_1.Bind(wx.EVT_BUTTON, self.OnButton )</pre><p>Pressing the button will now write a message to the command line. Instead of the boring command line message, we want to show a message box. This can be done using this command:</p><pre class="crayon-plain-tag">wx.MessageBox( "This is a message.", "Button pressed.");</pre><p>The full code below:</p><pre class="crayon-plain-tag">#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8 on Fri Jan 23 22:59:56 2015
#

import wx

# begin wxGlade: dependencies
import gettext
# end wxGlade

# begin wxGlade: extracode
# end wxGlade


class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.button_1 = wx.Button(self, wx.ID_ANY, _("Hello World!"))
        self.button_1.Bind(wx.EVT_BUTTON, self.OnButton )

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle(_("wxWidgets button example. talkera.org/python "))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(self.button_1, 0, 0, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

    def OnButton(event, button_label):
        wx.MessageBox( "This is a message.", "Button pressed.");
  

# end of class MyFrame
if __name__ == "__main__":
    gettext.install("app") # replace with the appropriate catalog name

    app = wx.PySimpleApp(0)
    wx.InitAllImageHandlers()
    frame_1 = MyFrame(None, wx.ID_ANY, "")
    app.SetTopWindow(frame_1)
    frame_1.Show()
    app.MainLoop()</pre><p><a href="/python/wp-content/uploads/2015/01/gui.png"><img class="alignnone size-medium wp-image-73" src="/python/wp-content/uploads/2015/01/gui-300x154.png" alt="wxWidgets gui python" width="300" height="154" /></a></p>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;linkname=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;linkname=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;linkname=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;linkname=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" title="Reddit" rel="nofollow" target="_blank"></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;linkname=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" title="StumbleUpon" rel="nofollow" target="_blank"></a><a class="a2a_button_pinterest" href="http://www.addtoany.com/add_to/pinterest?linkurl=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;linkname=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" title="Pinterest" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="https://www.addtoany.com/share_save#url=http%3A%2F%2Ftalkera.org%2Fpython%2Fcreating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners%2F&amp;title=Creating%20a%20gui%20in%20Python%20with%20WxWidgets%20%5Btutorial%20for%20beginners%5D" id="wpa2a_6"></a></p>]]></content:encoded>
			<wfw:commentRss>https://talkera.org/python/creating-a-gui-in-python-with-wxwidgets-tutorial-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
