@@ -71,8 +71,6 @@ \section{Introduction}
7171
7272\begin {frame }[fragile]{Python Options}
7373
74-
75-
7674{\Large Multiple GUI frameworks available:}
7775
7876\begin {itemize }
@@ -87,6 +85,7 @@ \section{Introduction}
8785
8886\end {frame }
8987
88+
9089\section {wxPython }
9190
9291\begin {frame }[fragile]{wxPython}
@@ -203,6 +202,56 @@ \section{wxPython}
203202
204203\end {frame }
205204
205+ % -------------------------------
206+ \begin {frame }[fragile]{Pythonic code:}
207+
208+
209+ \vfill
210+ {\Large Over the years, wxPython has grown a number of things to make it more `` pythonic'' -- hide some of that C++ legacy}
211+
212+ \vfill
213+ {\Large Properties:}
214+
215+ {\large The C++ classes are full of getters and setters:}
216+ \begin {verbatim }
217+ wxTextCtrl::GetValue
218+ wxTextCtrl::GetValue
219+ \end {verbatim }
220+
221+ {\large These methods have been translated into properties for Python}
222+ \begin {verbatim }
223+ MyTextCtrl.Value = some_string
224+ another_string = wxTextCtrl.Value
225+ \end {verbatim }
226+
227+ \vfill
228+ (The Get/Set versions are still there, but it's klunkier code)
229+ \end {frame }
230+
231+ % -------------------------------
232+ \begin {frame }[fragile]{Pythonic code:}
233+
234+
235+ \vfill
236+ {\Large Other Python options: some specific wx types can be accessed with standard python types:}
237+
238+ \vfill
239+ {\large \verb `wxPoint ` --- \verb `(x,y) ` ( tuple ) }
240+
241+ \vfill
242+ {\large \verb `wx.List ` --- \verb `[1,2,3] ` (python list) }
243+
244+ \vfill
245+ {\large \verb `wxSize ` --- \verb `(w,h) ` (tuple) }
246+
247+ \vfill
248+ {\large ....... }
249+
250+
251+ \vfill
252+ {\Large Using these makes your code cleaner and more pythonic}
253+
254+ \end {frame }
206255
207256\section {Basic Structure }
208257
@@ -367,6 +416,7 @@ \section{Basic Structure}
367416
368417\end {frame }
369418
419+ \section {controls }
370420
371421% -------------------------------
372422\begin {frame }[fragile]{Menus}
@@ -610,13 +660,13 @@ \section{Basic Structure}
610660{\Large The alternative is `` Sizers'' }
611661
612662\vfill
613- {\large \verb `wx.Sizer ` is wx's system for automatically determining the size an location of controls}
663+ {\large \verb `wx.Sizer ` is wx's system for automatically determining the size and location of controls}
614664
615665\vfill
616- {\large Instead of thinking in terms of what size an position a given control should be, you think in terms of how they relate to each other:}
666+ {\large Instead of thinking in terms of what size and position a given control should be, you think in terms of how they relate to each other:}
617667
618668\vfill
619- {\large `` I want a column of buttons all the same size along the left edge of the Panel'' }
669+ {\large \emph { `` I want a column of buttons all the same size along the left edge of the Panel'' } }
620670
621671\vfill
622672{\large Sizers capture that logic and compute the sizes for you}
@@ -735,7 +785,53 @@ \section{Basic Structure}
735785
736786\end {frame }
737787
788+
789+ % -------------------------------
790+ \begin {frame }[fragile]{Accessing inputs}
791+
792+ {\Large Much of the point of a GUI is to collect data from the user.}
793+
794+ \vfill
795+ {\large So you need to be able to access what s/he has input}
796+
797+ \begin {verbatim }
798+ ## add a text control:
799+ self.textControl = wx.TextCtrl(self)
800+
801+ def onGetData(self, evt=None):
802+ print "get data button pressed"
803+ contents = self.textControl.Value
804+ print "the contents are:", contents
805+ \end {verbatim }
806+
807+ {\large Most controls have a \verb `.Value ` property}
808+
809+ \end {frame }
810+
738811% -------------------------------
812+ \begin {frame }[fragile]{Setting Values}
813+
814+ {\Large You also want to display data...}
815+
816+ \vfill
817+ {\large So you need to be able to set the values, too:}
818+
819+ \begin {verbatim }
820+ ## and another text control:
821+ self.outTextControl = wx.TextCtrl(self, style=wx.TE_READONLY)
822+
823+ def onGetData(self, evt=None):
824+ self.outTextControl.Value = self.inTextControl.Value
825+
826+ \end {verbatim }
827+
828+ {\large You can set the \verb `.Value ` property too...}
829+
830+ \vfill
831+ example: \verb `code\basic_app8.py `
832+
833+ \end {frame }
834+
739835
740836% -------------------------------
741837\begin {frame }[fragile]{Long Running Tasks}
@@ -761,6 +857,8 @@ \section{Basic Structure}
761857
762858\end {frame }
763859
860+ \section {Miscellaneous }
861+
764862% -------------------------------
765863\begin {frame }[fragile]{CallAfter}
766864
@@ -810,6 +908,20 @@ \section{Basic Structure}
810908\vfill
811909{\Large Example: Cameo Chemicals}
812910
911+ \vfill
912+ (PyCon 2009: Browser Interface, Local Server Application)
913+ \end {frame }
914+
915+
916+ % -------------------------------
917+ \begin {frame }[fragile]{LAB}
918+
919+ \vfill
920+ {\Large Make a very simple address book app:}
921+ \vfill
922+
923+ \verb `code\address_book\ `
924+
813925\end {frame }
814926
815927
0 commit comments