I really appreciate John Fabiani's tutorials.  To my knowledge there is
nothing in the Dabo on-line documentation that explains Dabo programming to
the beginner so well.  I thank Ed for his corrections to John's work but
they did seem to come across a little like a school master correcting his
pupil in front of the class.  Maybe it is just me, but they seemed to have a
slightly harsh tone and I'm sure Ed did not intend them be so.  I hope John
continues his tutorials as these are sorely needed, at least by me.

Steve Rose
(rank beginner)


On 12/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> Send Dabo-users mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://leafe.com/mailman/listinfo/dabo-users
> or, via email, send a message with subject or body 'help' to
>         [EMAIL PROTECTED]
>
> You can reach the person managing the list at
>         [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Dabo-users digest..."
>
>
> Today's Topics:
>
>    1. Re: Standalone dabo games not running (bsnipes)
>    2. Re: Standalone dabo games not running (bsnipes)
>    3. Re: Standalone dabo games not running (johnf)
>    4. Re: Standalone dabo games not running (johnf)
>    5. Re: Standalone dabo games not running (Nate Lowrie)
>    6. Web update (Adrian Klaver)
>    7. Re: Standalone dabo games not running (Ed Leafe)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 3 Dec 2007 09:08:54 -0800 (PST)
> From: bsnipes <[EMAIL PROTECTED]>
> Subject: Re: [dabo-users] Standalone dabo games not running
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
>
>
>
> JohnF-4 wrote:
> >
> > Sounds fine.  But I have a little twist.  Instead of me just building
> the
> > form
> > let's keep a running dialog via this email list of the steps to get it
> > done.
> > That way others can help and put their .02 in too .  And at the end I'll
> > gather the messages and put them on the wiki.   You are expected to ask
> > questions and make suggestions.  Let's get started.
> >
> Sounds good.  I can see my untimeliness was taken up by others... :-)
>
>
> JohnF-4 wrote:
> >
> > Ok lets add a little more to display a panel
> >
> > immediately after
> > self.Sizer =vs= dabo.ui.dSizer("vertical")
> >
> > add
> > vs.append(dabo.ui.dPanel(self,BackColor = "green))
> >
> > Run again.
> >
> > This should give you a little green box in the upper left hand corner.
> >
> > Ok now let's expand the panel to fill the form in several steps by
> adding
> > paramenters to the vs.append method.  Just add a ',1'.
> > .
> > vs.append(dabo.ui.dPanel(self,BackColor = "green),1)
> >
> > Run it again - what happened?.
> >
> > Now add one more parameter so it reads
> > vs.append(dabo.ui.dPanel(self,BackColor = "green),1,'x')
> >
> > At this point I will stop and ask you to tell me  (and others on the
> list)
> > what is happening.  Your clue is we are adding a
> container/control/object
> > to
> > a sizer using the the append method (function).
> >
>
> Ok... got most of that.  Looks like we should ideally start with a Form,
> add
> a Sizer and then a Panel on top of that.  I am assuming the '1' and the
> 'x'
> are proportion and then layout although there is no mention of 'x' in the
> dabo api docs but I am assuming it must be the shortcut for 'expand'.
>
> Is the layout() method needed?  It seems to still run the form even if I
> comment it out.
>
> Are all container/control/objects added using sizer.append()?
>
> Brian
> --
> View this message in context:
> http://www.nabble.com/Standalone-dabo-games-not-running-tf4896702.html#a14133849
> Sent from the dabo-users mailing list archive at Nabble.com.
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 3 Dec 2007 09:10:45 -0800 (PST)
> From: bsnipes <[EMAIL PROTECTED]>
> Subject: Re: [dabo-users] Standalone dabo games not running
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
>
>
>
>
> bsnipes wrote:
> >
> >
> > JohnF-4 wrote:
> >>
> >> Sounds fine.  But I have a little twist.  Instead of me just building
> the
> >> form
> >> let's keep a running dialog via this email list of the steps to get it
> >> done.
> >> That way others can help and put their .02 in too .  And at the end
> I'll
> >> gather the messages and put them on the wiki.   You are expected to ask
> >> questions and make suggestions.  Let's get started.
> >>
> > Sounds good.  I can see my untimeliness was taken up by others... :-)
> >
> >
> > JohnF-4 wrote:
> >>
> >> Ok lets add a little more to display a panel
> >>
> >> immediately after
> >> self.Sizer =vs= dabo.ui.dSizer("vertical")
> >>
> >> add
> >> vs.append(dabo.ui.dPanel(self,BackColor = "green))
> >>
> >> Run again.
> >>
> >> This should give you a little green box in the upper left hand corner.
> >>
> >> Ok now let's expand the panel to fill the form in several steps by
> adding
> >> paramenters to the vs.append method.  Just add a ',1'.
> >> .
> >> vs.append(dabo.ui.dPanel(self,BackColor = "green),1)
> >>
> >> Run it again - what happened?.
> >>
> >> Now add one more parameter so it reads
> >> vs.append(dabo.ui.dPanel(self,BackColor = "green),1,'x')
> >>
> >> At this point I will stop and ask you to tell me  (and others on the
> >> list)
> >> what is happening.  Your clue is we are adding a
> container/control/object
> >> to
> >> a sizer using the the append method (function).
> >>
> >
> > Ok... got most of that.  Looks like we should ideally start with a Form,
> > add a Sizer and then a Panel on top of that.  I am assuming the '1' and
> > the 'x' are proportion and then layout although there is no mention of
> 'x'
> > in the dabo api docs but I am assuming it must be the shortcut for
> > 'expand'.
> >
> > Is the layout() method needed?  It seems to still run the form even if I
> > comment it out.
> >
> > Are all container/control/objects added using sizer.append()?
> >
> > Brian
> >
>
> Just got further in the list and see where you answered the expand stuff.
> I'll wait to reply until finishing the entire thread next time.
>
> Brian
>
> --
> View this message in context:
> http://www.nabble.com/Standalone-dabo-games-not-running-tf4896702.html#a14133948
> Sent from the dabo-users mailing list archive at Nabble.com.
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 3 Dec 2007 09:22:36 -0800
> From: johnf <[EMAIL PROTECTED]>
> Subject: Re: [dabo-users] Standalone dabo games not running
> To: Dabo Users list <[email protected]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Monday 03 December 2007 09:08:54 am bsnipes wrote:
> > Is the layout() method needed? ?It seems to still run the form even if I
> > comment it out.
> >
> Strictly speaking no the layout method is not required.  wxPython is smart
> and
> will do the work for you.  I added the line so others will see that a
> layout() is in fact called.  Later when you develop more complex forms the
> refresh() and layout() will become important.
>
>
> > Are all container/control/objects added using sizer.append()?
> You are right but there are exceptions.  Or maybe a better term would be
> tricks.  But let's hold off on the tricks for now.
>
>
>
>
> --
> John Fabiani
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 3 Dec 2007 11:27:31 -0800
> From: johnf <[EMAIL PROTECTED]>
> Subject: Re: [dabo-users] Standalone dabo games not running
> To: Dabo Users list <[email protected]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="utf-8"
>
> Hopefully, everyone completely understands sizers - LOL.  I laugh because
> I
> sometimes get confused using sizers.  But rest assured that you will get
> the
> hang of it and most of the time it's easy.  Just play with them until get
> what you want.  It also helps to draw a little picture of what you want
> the
> form to look like before starting and you'll get there.  You may have
> noticed
> I did not explain the use of a ?grid sizer?.   I didn't because it really
> does not fit into this tutorial.  But I use the grid sizer often.  It
> helps
> maintain ?control/object? alignment on the form.  Maybe later I (or
> someone
> else) can provide a demo using a grid sizer.
>
> In the Visual Fox Pro world (windows) Adrian's request of a demo to
> ?browse
> directories? would have taken but a short time to develop and deliver.   I
> would create a form, add a label, add a textbox, and a button to activate
> the
> open file dialog.  Maybe all of ten minutes.  Well I just timed it and it
> took 12 minutes in Dabo (mostly because I can't type ? you'd think after
> twenty years I learn how to type).  Anyway, my point is Dabo's framework (
> and everything Dabo is built on wxPython, Python) is just as powerful as
> VFP,
> VB and all the other languages.  And in my mind it is more powerful
> because
> it's cross platform and one of the easiest languages to read and
> understand.
> But I guess I'm singing to the choir since those that are reading this are
> at
> least considering moving to Dabo for those very reasons.
>
> Sorry got off topic!
>
> Like all modern day languages the Dabo framework has events.  When the
> user
> clicks on a button with the mouse an event occurs.  With Dabo you have
> to ?bind? the event to some action (function, method).     Most languages
> do
> the same thing.  In java they are called event listeners, in C++ they are
> called callbacks.  Some languages sort of hide the events methods as in
> VFP
> where the event method is on a property page.  But you can bet it is there
> somewhere.
>
> The first thing we need to do with Dabo is to import the list of
> events.  I'm
> taking a minor short cut here.  I am naming 'dabo.dEvents' as 'dEvents'
> just
> to save a little typing.  You should see the line near the top of the
> program.
>
> import dabo.dEvents as dEvents
>
> So now we have a list of available Dabo events and we need explain how to
> use
> them.  I'll show you the long way of binding an event.  I think it better
> explains what is happening.  Maybe someone would like to post the easy way
> to
> bind an event ? all on one line of code.
>
> The next line of code assigns a variable ?ourButton? for a Dabo button.
> Notice that I have added a new attribute ?RegID?.  Every control/object
> within the Dabo framework can have a ?RegID? (or a name?).  It should be
> unique and if you don't assign a ?RegID? the framework will assign
> one.  This
> is cool because it allows us (the programmers) to later reference the
> object.
> Knowing the ?RegID? I can later assign a value or change a value or
> property
> of the object.
>
> ourButton=dabo.ui.dButton(self,RegID="selectButton",Caption= "...")
>
> Now that I have a button I want something to happen when I click on the
> button.  With VFP I would find the ?click? method of the object and type
> in
> the name of a function I want executed when the object was clicked.  It'
> similar in Dabo.  I first tell the object what event I want to control and
> what method/function I want to execute.  As follows:
>
> ourButton = the name of the object (our variable).
>
> bindEvent = what I doing  - the method ? I'm binding an event.
>
> dEvents.Hit = (recall my little short cut) which of the many events I want
> bound.
>
> self._openDialog = the method/function I want executed when the event
> occurs.
>
> ourButton.bindEvent(dEvents.Hit, self._openDialog)
>
> Yes you're right ? the event names don't match windows event names.  But a
> rose smells just as sweet no matter what it's called (or something close
> to
> that ? you know what I mean).  The point is the event names are
> descriptive
> enough for you to guess what they do.
>
> Now let's open a file dialog.
> def _openDialog(self,evt):
>                 # need to pass the evt (in this case a click or Hit)
>                 evt.stop()
>                 theDialog=dabo.ui.dFileDialog(self)
>                 theDialog.show()
>
> First you must pass the event (in this case ?evt?) otherwise the program
> will
> complain.  The ?evt? variable is very powerful. Using evt.EventObject
> provides the calling objects ?ID? for example ? there are many other
> attributes.  I have only scratched the surface with binds and events.  But
> that's all that is needed for our tutorial.  And I bet you'll not need
> much
> more for your future programs.  The next two lines are a demonstration of
> the
> what is already built in to Dabo.  I didn't have to write a line of code.
>
> I have not used the Dabo textbox in this example.  Maybe someone might try
> and
> retrieve the filename picked and display it in the textbox.  Post your
> code.
>
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> import os
> import dabo
> import dabo.dEvents as dEvents
> import dabo.dException as dException
> dabo.ui.loadUI('wx')
>
> class MainForm(dabo.ui.dForm):
>
>         def afterInit(self):
>                 self.Caption = "File Tutorial"
>                 self.Sizer =hs= dabo.ui.dSizer("h")
>
>                 hs.append(dabo.ui.dLabel(self, Caption= "Select a
> file"),0)
>                 hs.append(dabo.ui.dTextBox(self,RegID = "filename"),1)
>                 ourButton=dabo.ui.dButton(self,RegID="selectButton",Caption=
> "...")
>                 ourButton.bindEvent(dEvents.Hit, self._openDialog)
>                 hs.append(ourButton,0)
>
>                 self.layout()
>
>         def _openDialog(self,evt):
>                 # need to pass the evt (in this case a click or Hit)
>                 evt.stop()  #no need to pass the evt on I got what I want
>                 theDialog=dabo.ui.dFileDialog(self)
>                 theDialog.show()
>
> if __name__ == "__main__":
>         app = dabo.dApp()
>
>         app.BasePrefKey = "fileTutor"
>         app.setAppInfo("appName", "File Tutorial ")
>
>         app.MainFormClass = MainForm
>
>         app.start()
>
>
> As always if made a mistake help me fix it.
> --
> John Fabiani
>
>
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 3 Dec 2007 13:46:04 -0700
> From: "Nate Lowrie" <[EMAIL PROTECTED]>
> Subject: Re: [dabo-users] Standalone dabo games not running
> To: "Dabo Users list" <[email protected]>
> Message-ID:
>         <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=WINDOWS-1252
>
> On Dec 3, 2007 12:27 PM, johnf <[EMAIL PROTECTED]> wrote:
> > Hopefully, everyone completely understands sizers - LOL.  I laugh
> because I
> > sometimes get confused using sizers.  But rest assured that you will get
> the
> > hang of it and most of the time it's easy.  Just play with them until
> get
> > what you want.  It also helps to draw a little picture of what you want
> the
> > form to look like before starting and you'll get there.  You may have
> noticed
> > I did not explain the use of a "grid sizer".   I didn't because it
> really
> > does not fit into this tutorial.  But I use the grid sizer often.  It
> helps
> > maintain "control/object" alignment on the form.  Maybe later I (or
> someone
> > else) can provide a demo using a grid sizer.
> >
> > In the Visual Fox Pro world (windows) Adrian's request of a demo to
> "browse
> > directories" would have taken but a short time to develop and deliver.
> I
> > would create a form, add a label, add a textbox, and a button to
> activate the
> > open file dialog.  Maybe all of ten minutes.  Well I just timed it and
> it
> > took 12 minutes in Dabo (mostly because I can't type ? you'd think after
> > twenty years I learn how to type).  Anyway, my point is Dabo's framework
> (
> > and everything Dabo is built on wxPython, Python) is just as powerful as
> VFP,
> > VB and all the other languages.  And in my mind it is more powerful
> because
> > it's cross platform and one of the easiest languages to read and
> understand.
> > But I guess I'm singing to the choir since those that are reading this
> are at
> > least considering moving to Dabo for those very reasons.
> >
> >  Sorry got off topic!
> >
> > Like all modern day languages the Dabo framework has events.  When the
> user
> > clicks on a button with the mouse an event occurs.  With Dabo you have
> > to "bind" the event to some action (function, method).     Most
> languages do
> > the same thing.  In java they are called event listeners, in C++ they
> are
> > called callbacks.  Some languages sort of hide the events methods as in
> VFP
> > where the event method is on a property page.  But you can bet it is
> there
> > somewhere.
> >
> > The first thing we need to do with Dabo is to import the list of
> events.  I'm
> > taking a minor short cut here.  I am naming 'dabo.dEvents' as 'dEvents'
> just
> > to save a little typing.  You should see the line near the top of the
> > program.
> >
> > import dabo.dEvents as dEvents
> >
> > So now we have a list of available Dabo events and we need explain how
> to use
> > them.  I'll show you the long way of binding an event.  I think it
> better
> > explains what is happening.  Maybe someone would like to post the easy
> way to
> > bind an event ? all on one line of code.
> >
> > The next line of code assigns a variable "ourButton" for a Dabo button.
> > Notice that I have added a new attribute "RegID".  Every control/object
> > within the Dabo framework can have a "RegID" (or a name?).  It should be
> > unique and if you don't assign a "RegID" the framework will assign
> one.  This
> > is cool because it allows us (the programmers) to later reference the
> object.
> > Knowing the "RegID" I can later assign a value or change a value or
> property
> > of the object.
>
> Note that the RegID is just a shortcut.  So, if you have a form that
> has a button on it embedded deep within a tree, and you want to access
> it from the form you would normally have to type something to the
> effect of self.panel.pageFrame.Pages[0].myFirstSizer.control to access
> it.  With a RegID, you can just go self.control.
>
> Note that it is not always advantageous to use a RegID.  Since each
> control on a form needs a UNIQUE regID, if you have a panel class
> whose controls are declared with RegIDs that you use more than once in
> a form, you will get a bunch of errors.  Truth is, I rarely use RegIDs
> anymore, since I can normally encapsulate control functionality into a
> panel class.  Makes for cleaner code that is more modularized and
> refactored IMHO.
>
> Cheers,
>
> Nate L.
>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 03 Dec 2007 20:52:38 +0000
> From: [EMAIL PROTECTED] (Adrian Klaver)
> Subject: [dabo-users] Web update
> To: [email protected]
> Message-ID:
>         <
> [EMAIL PROTECTED]
> >
>
>
> When I run the update I get:
>
> Traceback (most recent call last):
>   File
> "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/ui/uiwx/dControlMixi
> n.py", line 21, in _onWxHit
>     self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
>   File
> "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/ui/uiwx/dPemMixin.py
> ", line 843, in raiseEvent
>     super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,
> **kwargs)
>   File
> "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/lib/eventMixin.py",
> line 92, in raiseEvent
>     bindingFunction(event)
>   File
> "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/ui/dialogs/Preferenc
> eDialog.py", line 272, in onCheckNow
>     ret = self.Application.checkForUpdates()
>   File "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/dApp.py",
> line 385, in checkForUpdates
>     return self.uiApp.checkForUpdates(force=True)
>   File
> "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/ui/uiwx/uiApp.py",
> line 187, in checkForUpdates
>     vers = self.dApp._updateFramework()
>   File "/usr/lib/python2.5/site-packages/Dabo-0.8.2-py2.5.egg
> /dabo/dApp.py",
> line 455, in _updateFramework
>     os.mkdirs(localPath)
> AttributeError: 'module' object has no attribute 'mkdirs'
>
> I guess os has either mkdir or makedirs. I didn't study the code to see
> which
> one you intend.
> --
> Adrian Klaver
> [EMAIL PROTECTED]
>
>
>
>
> ------------------------------
>
> Message: 7
> Date: Mon, 3 Dec 2007 15:54:54 -0500
> From: Ed Leafe <[EMAIL PROTECTED]>
> Subject: Re: [dabo-users] Standalone dabo games not running
> To: Dabo Users list <[email protected]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes;
>         format=flowed
>
>         Some corrections interspersed with your post:
>
> > The next line of code assigns a variable ?ourButton? for a Dabo
> > button.
> > Notice that I have added a new attribute ?RegID?.  Every control/
> > object
> > within the Dabo framework can have a ?RegID? (or a name?).  It
> > should be
> > unique and if you don't assign a ?RegID? the framework will assign
> > one.  This
> > is cool because it allows us (the programmers) to later reference
> > the object.
> > Knowing the ?RegID? I can later assign a value or change a value or
> > property
> > of the object.
> >
> > ourButton=dabo.ui.dButton(self,RegID="selectButton",Caption= "...")
>
>         Couple of things. First, Python doesn't have variables; it has
> local
> names for objects. You might think that this is hair-splitting, but
> there are substantial differences, and long-time Pythonistas will
> sneer at you if you call them 'variables'.
>
>         More importantly, you are confusing 'RegID' with an object's name.
> The only thing that a RegID does is provide a unique identifier
> within a form for an object that needs to be referenced from
> somewhere else. They should never be used at a class level, such as a
> custom container with a bunch of controls on it, since you don't know
> what else may be on the form when that class is used. Dabo does not
> assign RegIDs.
>
> > Now let's open a file dialog.
> > def _openDialog(self,evt):
> >               # need to pass the evt (in this case a click or Hit)
> >               evt.stop()
>
>         You definitely don't need to stop() the event, since button events
> are not propagated up the containership tree. You should almost never
> need to issue stop() for an event.
>
> >               theDialog=dabo.ui.dFileDialog(self)
> >               theDialog.show()
> >
> > First you must pass the event (in this case ?evt?) otherwise the
> > program will
> > complain.
>
>         You don't "pass" the event; you have to accept it.
>
>         Events are raised by the UI. You write event handlers to react to
> those events, and those handlers must accept an event object.
>
> > The ?evt? variable is very powerful. Using evt.EventObject
> > provides the calling objects ?ID? for example ? there are many other
> > attributes.
>
>         It's not a calling object, as it isn't doing any calling. It is
> the
> object for which the event was raised. You may think it is just
> semantics, but when you are creating a document to instruct others,
> you must use the correct terminology.
>
>
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
>
>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Dabo-users mailing list
> [email protected]
> http://leafe.com/mailman/listinfo/dabo-users
> Searchable Archives: http://leafe.com/archives/search/dabo-users
>
>
> End of Dabo-users Digest, Vol 42, Issue 4
> *****************************************
>


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to