SlideShare a Scribd company logo
1 of 20
Download to read offline
wxPython and wxFormBuilder

      jsliang.tw@gmail.com
            Jenny Liang
a GUI toolkit for Python

wxPython


                           2
Introduction to wxPython
   wxPython is a GUI toolkit for Python.
   • Download: http://wxpython.org/
   • Built upon the wxWidgets C++ toolkit
          – See http://wxWidgets.org/
   • Cross platform
          – Windows, Linux, Unix, OS X
          – Uses native widgets/controls, plus many platform
            independent widgets.

Reference: http://wxpython.org/OSCON2008/wxPython-Advanced-OSCON2008.pdf   3
Architecture
                                                wxPython Library


                                        wxPython Extension Modules


                                                wxWidgets Toolkit


                                                           Platform GUI


                                                Operating System



Reference: http://wxpython.org/OSCON2008/wxPython-Advanced-OSCON2008.pdf   4
Partial Class Hierarchy
                                                                      wx.Object


                                             wx.EvtHandler


                                              wx.Window


                   wx.TopLevelWindow           wx.Panel                    wx.Control


                 wx.Frame        wx.Dialog        wx.ScrolledWindow           wx.StaticText


                         …               …                                    wx.TextCtrl


                                                                                  …


Reference: http://wxpython.org/OSCON2008/wxPython-Advanced-OSCON2008.pdf                      5
Windows or Frames?
    • A wx.Window is the base class from which all
      visual elements are derived.
           – buttons, menus, etc
    • What we normally think of as a program
      window is a wx.Frame.




Reference: http://wiki.wxpython.org/Getting%20Started   6
Getting started with wxPython
http://wiki.wxpython.org/Getting%20Started
• A First Application: "Hello, World“
• Building a simple text editor




                                             7
A First Application: "Hello, World"
    #!/usr/bin/env python
    import wx

    # Create a new app, don't redirect stdout/stderr to a window.
    app = wx.App(False)

     # A Frame is a top-level window.
    frame = wx.Frame(None, wx.ID_ANY, "Hello World")

    frame.Show(True) # Show the frame.
    app.MainLoop()




Reference: http://wiki.wxpython.org/Getting%20Started               8
A Simple Text Editor with Menu
import wx
class MainWindow(wx.Frame):
   def __init__(self, parent, title):
     wx.Frame.__init__(self, parent, title=title, size=(200,100))
     self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
     self.CreateStatusBar() # A Statusbar in the bottom of the window
     filemenu = wx.Menu() # Setting up the menu.
     # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
     filemenu.Append(wx.ID_ABOUT, "&About", " Information about this program")
     filemenu.AppendSeparator()
     filemenu.Append(wx.ID_EXIT, "E&xit", " Terminate the program")
     # Creating the menubar.
     menuBar = wx.MenuBar()
     menuBar.Append(filemenu, "&File") # Adding the "filemenu" to the MenuBar
     self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content
     self.Show(True)
app = wx.App(False)
frame = MainWindow(None, "Sample editor")
app.MainLoop()

                                                      Reference: http://wiki.wxpython.org/Getting%20Started   9
GUI designer application for wxWidgets toolkit

wxFormBuilder (wxFB)


                                                 10
Introduction to wxFB
• wxFormBuilder is an open source GUI
  designer application for wxWidgets toolkit.
  – a visual development tool
  – File extension: *.fbp
     • can emit C++ (*.h & *.cpp), Python (*.py) and XRC
       (*.xrc) codes
• wxFormBuilder have a rich set of supported
  widgets.
  – http://en.wikipedia.org/wiki/WxFormBuilder
                                                           11
12
13
14
15
Press F8, and gui.py
 will be generated
http://goo.gl/RxGD6




                       16
Event Handlers (1/2)
# file: gui.py (generated by wxFB)
import wx
import wx.xrc

###########################################################################
## Class Sheetaholics_MainFrame
###########################################################################

class Sheetaholics_Main ( wx.Frame ):

  def __init__( self, parent ):
    ... ( codes for layout )

    # Connect Events
    self.btn_dottedlined_genpdf.Bind( wx.EVT_BUTTON, self.btn_dottedlined_genpdfOnButtonClick )

  def __del__( self ):
    pass

  # Virtual event handlers, override them in your derived class
  def btn_dottedlined_genpdfOnButtonClick( self, event ):
    event.Skip()                                                                                  17
Event Handlers (2/2)
# file: main.py
import gui # import gui.py, which was generated by wxFB
import wx

class Sheetaholics_MainFrame( gui.Sheetaholics_MainFrame ): # inherit gui.Sheetaholics_MainFrame
   def __init__( self, parent ):
     gui.Sheetaholics_MainFrame.__init__( self, parent )

  # handler for Sheetaholics_MainFrame event
  def btn_dottedlined_genpdfOnButtonClick( self, event ):
    ... ( event handler contents here )

class SheetaholicsMain(wx.App):
  def OnInit(self):
     self.m_frame = Sheetaholics_MainFrame(None)
     self.m_frame.Show()
     return True

app = SheetaholicsMain(0)
app.MainLoop()

                                                                                                   18
References
• wxWidgets
  • http://wxwidgets.org/
• wxPython
  – http://wxpython.org/
  – http://wiki.wxpython.org/How%20to%20Learn%20wxPyth
    on
  – http://wiki.wxpython.org/Getting%20Started
• wxFormBuilder
  – http://wxformbuilder.org/
  – http://sourceforge.net/apps/mediawiki/wxformbuilder/in
    dex.php?title=Tutorials
  – http://en.wikipedia.org/wiki/WxFormBuilder

                                                         19
Q&A




      20

More Related Content

What's hot

Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxSadia Bashir
 
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Ahmed El-Arabawy
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scriptingvceder
 
CLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHONCLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHONLalitkumar_98
 
Storage classes in c++
Storage classes in c++Storage classes in c++
Storage classes in c++Jaspal Singh
 
Component object model and
Component object model andComponent object model and
Component object model andSaransh Garg
 
tkinter final ppt.ppt
tkinter final ppt.ppttkinter final ppt.ppt
tkinter final ppt.pptKanuAgrawal2
 
Vi editor Linux Editors
Vi editor Linux EditorsVi editor Linux Editors
Vi editor Linux EditorsTONO KURIAKOSE
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#Adeel Rasheed
 
Basic Structure of C Language and Related Term
Basic Structure of C Language  and Related TermBasic Structure of C Language  and Related Term
Basic Structure of C Language and Related TermMuhammadWaseem305
 
Terminal Commands (Linux - ubuntu) (part-1)
Terminal Commands  (Linux - ubuntu) (part-1)Terminal Commands  (Linux - ubuntu) (part-1)
Terminal Commands (Linux - ubuntu) (part-1)raj upadhyay
 

What's hot (20)

Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in Linux
 
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers
 
Python Manuel-R2021.pdf
Python Manuel-R2021.pdfPython Manuel-R2021.pdf
Python Manuel-R2021.pdf
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
C# in depth
C# in depthC# in depth
C# in depth
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Python modules
Python modulesPython modules
Python modules
 
CLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHONCLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHON
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Storage classes in c++
Storage classes in c++Storage classes in c++
Storage classes in c++
 
JAVA PROGRAMMING - The Collections Framework
JAVA PROGRAMMING - The Collections Framework JAVA PROGRAMMING - The Collections Framework
JAVA PROGRAMMING - The Collections Framework
 
Component object model and
Component object model andComponent object model and
Component object model and
 
tkinter final ppt.ppt
tkinter final ppt.ppttkinter final ppt.ppt
tkinter final ppt.ppt
 
Vi editor Linux Editors
Vi editor Linux EditorsVi editor Linux Editors
Vi editor Linux Editors
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#
 
Vi editor
Vi   editorVi   editor
Vi editor
 
JAVA PROGRAMMING- Exception handling - Multithreading
JAVA PROGRAMMING- Exception handling - MultithreadingJAVA PROGRAMMING- Exception handling - Multithreading
JAVA PROGRAMMING- Exception handling - Multithreading
 
Basic Structure of C Language and Related Term
Basic Structure of C Language  and Related TermBasic Structure of C Language  and Related Term
Basic Structure of C Language and Related Term
 
Terminal Commands (Linux - ubuntu) (part-1)
Terminal Commands  (Linux - ubuntu) (part-1)Terminal Commands  (Linux - ubuntu) (part-1)
Terminal Commands (Linux - ubuntu) (part-1)
 

Viewers also liked

Lightning Talk: jsPDF
Lightning Talk: jsPDFLightning Talk: jsPDF
Lightning Talk: jsPDFJenny Liang
 
PyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミングPyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミングRansui Iso
 
Портфолио Курмаевой С.И.
Портфолио Курмаевой С.И.Портфолио Курмаевой С.И.
Портфолио Курмаевой С.И.ipevm1979
 
Gender mainstreaming of public campaigns
Gender mainstreaming of public campaignsGender mainstreaming of public campaigns
Gender mainstreaming of public campaignsElise Beyst
 
Art & science part ii
Art & science part iiArt & science part ii
Art & science part iiCormac McGrath
 
Контент и конверсионный трафик. Взаимное влияние
Контент и конверсионный трафик. Взаимное влияниеКонтент и конверсионный трафик. Взаимное влияние
Контент и конверсионный трафик. Взаимное влияниеАнастасия Эебердиева
 
Выпускной
ВыпускнойВыпускной
ВыпускнойAkuJIa
 
школы агинское итоги егэ_гиа_2011
школы агинское итоги егэ_гиа_2011школы агинское итоги егэ_гиа_2011
школы агинское итоги егэ_гиа_2011biolog259
 
Міський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазії
Міський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазіїМіський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазії
Міський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазії08600 Vasilkov
 
MSH Design Brochure (draft / test)
MSH Design Brochure (draft / test)MSH Design Brochure (draft / test)
MSH Design Brochure (draft / test)MSHDinc
 
Technology and Education
Technology and EducationTechnology and Education
Technology and Educationrogersc05
 
[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介
[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介
[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介DNA Data Bank of Japan center
 

Viewers also liked (20)

Lightning Talk: jsPDF
Lightning Talk: jsPDFLightning Talk: jsPDF
Lightning Talk: jsPDF
 
PyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミングPyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミング
 
Портфолио Курмаевой С.И.
Портфолио Курмаевой С.И.Портфолио Курмаевой С.И.
Портфолио Курмаевой С.И.
 
Gender mainstreaming of public campaigns
Gender mainstreaming of public campaignsGender mainstreaming of public campaigns
Gender mainstreaming of public campaigns
 
Art & science part ii
Art & science part iiArt & science part ii
Art & science part ii
 
המעצבים עבודות חוץ
המעצבים עבודות חוץהמעצבים עבודות חוץ
המעצבים עבודות חוץ
 
Spice
SpiceSpice
Spice
 
Контент и конверсионный трафик. Взаимное влияние
Контент и конверсионный трафик. Взаимное влияниеКонтент и конверсионный трафик. Взаимное влияние
Контент и конверсионный трафик. Взаимное влияние
 
Выпускной
ВыпускнойВыпускной
Выпускной
 
школы агинское итоги егэ_гиа_2011
школы агинское итоги егэ_гиа_2011школы агинское итоги егэ_гиа_2011
школы агинское итоги егэ_гиа_2011
 
47 amazing blog designs
47 amazing blog designs47 amazing blog designs
47 amazing blog designs
 
Sath poomch
Sath poomchSath poomch
Sath poomch
 
Lettura
LetturaLettura
Lettura
 
Міський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазії
Міський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазіїМіський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазії
Міський етап Всеукраїнського гуманітарного конкурсу КосмічнІ фантазії
 
Pecha Kucha
Pecha KuchaPecha Kucha
Pecha Kucha
 
Carlos carolinajessica
Carlos carolinajessicaCarlos carolinajessica
Carlos carolinajessica
 
Apexcse
ApexcseApexcse
Apexcse
 
MSH Design Brochure (draft / test)
MSH Design Brochure (draft / test)MSH Design Brochure (draft / test)
MSH Design Brochure (draft / test)
 
Technology and Education
Technology and EducationTechnology and Education
Technology and Education
 
[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介
[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介
[DDBJing29]DDBJ Sequence Read Archive (DRA) の紹介
 

Similar to wxPython and wxFormBuilder

Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKitLouis D'hauwe
 
WordPress Plugin Development 201
WordPress Plugin Development 201WordPress Plugin Development 201
WordPress Plugin Development 201ylefebvre
 
The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84Mahmoud Samir Fayed
 
Introduction to eZ Platform v2 UI Customization
Introduction to eZ Platform v2 UI CustomizationIntroduction to eZ Platform v2 UI Customization
Introduction to eZ Platform v2 UI CustomizationJani Tarvainen
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxmoirarandell
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Maurizio Pelizzone
 
OpenWhisk Under the Hood -- London Oct 16 2016
OpenWhisk Under the Hood -- London Oct 16 2016OpenWhisk Under the Hood -- London Oct 16 2016
OpenWhisk Under the Hood -- London Oct 16 2016Stephen Fink
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHPWilliam Lee
 
Lesson 02 - React Native Development Environment Setup
Lesson 02 - React Native Development Environment SetupLesson 02 - React Native Development Environment Setup
Lesson 02 - React Native Development Environment SetupUniversity of Catania
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with ComposerAdam Englander
 
The Ring programming language version 1.5.4 book - Part 71 of 185
The Ring programming language version 1.5.4 book - Part 71 of 185The Ring programming language version 1.5.4 book - Part 71 of 185
The Ring programming language version 1.5.4 book - Part 71 of 185Mahmoud Samir Fayed
 
Docker presentasjon java bin
Docker presentasjon java binDocker presentasjon java bin
Docker presentasjon java binOlve Hansen
 
Relaxing CNDs Hippo GetTogether
Relaxing CNDs Hippo GetTogetherRelaxing CNDs Hippo GetTogether
Relaxing CNDs Hippo GetTogetherFrank Van Lankvelt
 

Similar to wxPython and wxFormBuilder (20)

Getting started with wxWidgets
Getting started with wxWidgets Getting started with wxWidgets
Getting started with wxWidgets
 
GNURAdioDoc-8
GNURAdioDoc-8GNURAdioDoc-8
GNURAdioDoc-8
 
GNURAdioDoc-8
GNURAdioDoc-8GNURAdioDoc-8
GNURAdioDoc-8
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKit
 
manual
manualmanual
manual
 
manual
manualmanual
manual
 
WordPress Plugin Development 201
WordPress Plugin Development 201WordPress Plugin Development 201
WordPress Plugin Development 201
 
The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Introduction to eZ Platform v2 UI Customization
Introduction to eZ Platform v2 UI CustomizationIntroduction to eZ Platform v2 UI Customization
Introduction to eZ Platform v2 UI Customization
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
 
OpenWhisk Under the Hood -- London Oct 16 2016
OpenWhisk Under the Hood -- London Oct 16 2016OpenWhisk Under the Hood -- London Oct 16 2016
OpenWhisk Under the Hood -- London Oct 16 2016
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHP
 
Lesson 02 - React Native Development Environment Setup
Lesson 02 - React Native Development Environment SetupLesson 02 - React Native Development Environment Setup
Lesson 02 - React Native Development Environment Setup
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
The Ring programming language version 1.5.4 book - Part 71 of 185
The Ring programming language version 1.5.4 book - Part 71 of 185The Ring programming language version 1.5.4 book - Part 71 of 185
The Ring programming language version 1.5.4 book - Part 71 of 185
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Docker presentasjon java bin
Docker presentasjon java binDocker presentasjon java bin
Docker presentasjon java bin
 
Relaxing CNDs Hippo GetTogether
Relaxing CNDs Hippo GetTogetherRelaxing CNDs Hippo GetTogether
Relaxing CNDs Hippo GetTogether
 

Recently uploaded

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Recently uploaded (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

wxPython and wxFormBuilder

  • 1. wxPython and wxFormBuilder jsliang.tw@gmail.com Jenny Liang
  • 2. a GUI toolkit for Python wxPython 2
  • 3. Introduction to wxPython wxPython is a GUI toolkit for Python. • Download: http://wxpython.org/ • Built upon the wxWidgets C++ toolkit – See http://wxWidgets.org/ • Cross platform – Windows, Linux, Unix, OS X – Uses native widgets/controls, plus many platform independent widgets. Reference: http://wxpython.org/OSCON2008/wxPython-Advanced-OSCON2008.pdf 3
  • 4. Architecture wxPython Library wxPython Extension Modules wxWidgets Toolkit Platform GUI Operating System Reference: http://wxpython.org/OSCON2008/wxPython-Advanced-OSCON2008.pdf 4
  • 5. Partial Class Hierarchy wx.Object wx.EvtHandler wx.Window wx.TopLevelWindow wx.Panel wx.Control wx.Frame wx.Dialog wx.ScrolledWindow wx.StaticText … … wx.TextCtrl … Reference: http://wxpython.org/OSCON2008/wxPython-Advanced-OSCON2008.pdf 5
  • 6. Windows or Frames? • A wx.Window is the base class from which all visual elements are derived. – buttons, menus, etc • What we normally think of as a program window is a wx.Frame. Reference: http://wiki.wxpython.org/Getting%20Started 6
  • 7. Getting started with wxPython http://wiki.wxpython.org/Getting%20Started • A First Application: "Hello, World“ • Building a simple text editor 7
  • 8. A First Application: "Hello, World" #!/usr/bin/env python import wx # Create a new app, don't redirect stdout/stderr to a window. app = wx.App(False) # A Frame is a top-level window. frame = wx.Frame(None, wx.ID_ANY, "Hello World") frame.Show(True) # Show the frame. app.MainLoop() Reference: http://wiki.wxpython.org/Getting%20Started 8
  • 9. A Simple Text Editor with Menu import wx class MainWindow(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(200,100)) self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE) self.CreateStatusBar() # A Statusbar in the bottom of the window filemenu = wx.Menu() # Setting up the menu. # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets. filemenu.Append(wx.ID_ABOUT, "&About", " Information about this program") filemenu.AppendSeparator() filemenu.Append(wx.ID_EXIT, "E&xit", " Terminate the program") # Creating the menubar. menuBar = wx.MenuBar() menuBar.Append(filemenu, "&File") # Adding the "filemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content self.Show(True) app = wx.App(False) frame = MainWindow(None, "Sample editor") app.MainLoop() Reference: http://wiki.wxpython.org/Getting%20Started 9
  • 10. GUI designer application for wxWidgets toolkit wxFormBuilder (wxFB) 10
  • 11. Introduction to wxFB • wxFormBuilder is an open source GUI designer application for wxWidgets toolkit. – a visual development tool – File extension: *.fbp • can emit C++ (*.h & *.cpp), Python (*.py) and XRC (*.xrc) codes • wxFormBuilder have a rich set of supported widgets. – http://en.wikipedia.org/wiki/WxFormBuilder 11
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. Press F8, and gui.py will be generated http://goo.gl/RxGD6 16
  • 17. Event Handlers (1/2) # file: gui.py (generated by wxFB) import wx import wx.xrc ########################################################################### ## Class Sheetaholics_MainFrame ########################################################################### class Sheetaholics_Main ( wx.Frame ): def __init__( self, parent ): ... ( codes for layout ) # Connect Events self.btn_dottedlined_genpdf.Bind( wx.EVT_BUTTON, self.btn_dottedlined_genpdfOnButtonClick ) def __del__( self ): pass # Virtual event handlers, override them in your derived class def btn_dottedlined_genpdfOnButtonClick( self, event ): event.Skip() 17
  • 18. Event Handlers (2/2) # file: main.py import gui # import gui.py, which was generated by wxFB import wx class Sheetaholics_MainFrame( gui.Sheetaholics_MainFrame ): # inherit gui.Sheetaholics_MainFrame def __init__( self, parent ): gui.Sheetaholics_MainFrame.__init__( self, parent ) # handler for Sheetaholics_MainFrame event def btn_dottedlined_genpdfOnButtonClick( self, event ): ... ( event handler contents here ) class SheetaholicsMain(wx.App): def OnInit(self): self.m_frame = Sheetaholics_MainFrame(None) self.m_frame.Show() return True app = SheetaholicsMain(0) app.MainLoop() 18
  • 19. References • wxWidgets • http://wxwidgets.org/ • wxPython – http://wxpython.org/ – http://wiki.wxpython.org/How%20to%20Learn%20wxPyth on – http://wiki.wxpython.org/Getting%20Started • wxFormBuilder – http://wxformbuilder.org/ – http://sourceforge.net/apps/mediawiki/wxformbuilder/in dex.php?title=Tutorials – http://en.wikipedia.org/wiki/WxFormBuilder 19
  • 20. Q&A 20