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

Formation PHP
Formation PHPFormation PHP
Formation PHPkemenaran
 
Systèmes d'Exploitation - chp5-gestion fichiers
Systèmes d'Exploitation - chp5-gestion fichiersSystèmes d'Exploitation - chp5-gestion fichiers
Systèmes d'Exploitation - chp5-gestion fichiersLilia Sfaxi
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDBLinaro
 
09 윈도우스타일
09 윈도우스타일09 윈도우스타일
09 윈도우스타일jaypi Ko
 
Corel -Resultado 2- Manipular Objetos Con la Herramienta del Programa
Corel -Resultado 2- Manipular Objetos Con la Herramienta del ProgramaCorel -Resultado 2- Manipular Objetos Con la Herramienta del Programa
Corel -Resultado 2- Manipular Objetos Con la Herramienta del ProgramaGerardo Manuel Cetina Camara
 
08 부모윈도우 자식윈도우
08 부모윈도우 자식윈도우08 부모윈도우 자식윈도우
08 부모윈도우 자식윈도우jaypi Ko
 
Android audio system(audioplicy_service)
Android audio system(audioplicy_service)Android audio system(audioplicy_service)
Android audio system(audioplicy_service)fefe7270
 
Ch1 traitement de texte
Ch1   traitement de texteCh1   traitement de texte
Ch1 traitement de texteWael Ismail
 
Crear Usuarios Masivamente, Rápido y Sencillo - Active Directory
Crear Usuarios Masivamente, Rápido y Sencillo - Active DirectoryCrear Usuarios Masivamente, Rápido y Sencillo - Active Directory
Crear Usuarios Masivamente, Rápido y Sencillo - Active DirectoryRaGaZoMe
 
Buildroot easy embedded system
Buildroot easy embedded systemBuildroot easy embedded system
Buildroot easy embedded systemNirma University
 
06 일반적 유형의 프로그램
06 일반적 유형의 프로그램06 일반적 유형의 프로그램
06 일반적 유형의 프로그램jaypi Ko
 
12 컨트롤에서의 메세지 처리
12 컨트롤에서의 메세지 처리12 컨트롤에서의 메세지 처리
12 컨트롤에서의 메세지 처리jaypi Ko
 
Diaporama initiation informatique
Diaporama initiation informatiqueDiaporama initiation informatique
Diaporama initiation informatiquebibriom
 
Cours complet Base de donne Bac
Cours complet Base de donne Bac Cours complet Base de donne Bac
Cours complet Base de donne Bac Amri Ossama
 

What's hot (20)

Formation PHP
Formation PHPFormation PHP
Formation PHP
 
Systèmes d'Exploitation - chp5-gestion fichiers
Systèmes d'Exploitation - chp5-gestion fichiersSystèmes d'Exploitation - chp5-gestion fichiers
Systèmes d'Exploitation - chp5-gestion fichiers
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDB
 
09 윈도우스타일
09 윈도우스타일09 윈도우스타일
09 윈도우스타일
 
Corel -Resultado 2- Manipular Objetos Con la Herramienta del Programa
Corel -Resultado 2- Manipular Objetos Con la Herramienta del ProgramaCorel -Resultado 2- Manipular Objetos Con la Herramienta del Programa
Corel -Resultado 2- Manipular Objetos Con la Herramienta del Programa
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
 
08 부모윈도우 자식윈도우
08 부모윈도우 자식윈도우08 부모윈도우 자식윈도우
08 부모윈도우 자식윈도우
 
Xmind
XmindXmind
Xmind
 
Android audio system(audioplicy_service)
Android audio system(audioplicy_service)Android audio system(audioplicy_service)
Android audio system(audioplicy_service)
 
Ch1 traitement de texte
Ch1   traitement de texteCh1   traitement de texte
Ch1 traitement de texte
 
Crear Usuarios Masivamente, Rápido y Sencillo - Active Directory
Crear Usuarios Masivamente, Rápido y Sencillo - Active DirectoryCrear Usuarios Masivamente, Rápido y Sencillo - Active Directory
Crear Usuarios Masivamente, Rápido y Sencillo - Active Directory
 
Buildroot easy embedded system
Buildroot easy embedded systemBuildroot easy embedded system
Buildroot easy embedded system
 
Windows 10
Windows 10Windows 10
Windows 10
 
Windows 7
Windows 7Windows 7
Windows 7
 
06 일반적 유형의 프로그램
06 일반적 유형의 프로그램06 일반적 유형의 프로그램
06 일반적 유형의 프로그램
 
12 컨트롤에서의 메세지 처리
12 컨트롤에서의 메세지 처리12 컨트롤에서의 메세지 처리
12 컨트롤에서의 메세지 처리
 
Diaporama initiation informatique
Diaporama initiation informatiqueDiaporama initiation informatique
Diaporama initiation informatique
 
Python
PythonPython
Python
 
Cours complet Base de donne Bac
Cours complet Base de donne Bac Cours complet Base de donne Bac
Cours complet Base de donne Bac
 
Vim Rocks!
Vim Rocks!Vim Rocks!
Vim Rocks!
 

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

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Recently uploaded (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

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