On Dec 5, 2007 10:42 AM, johnf <[EMAIL PROTECTED]> wrote: > > On Wednesday 05 December 2007 06:07:39 am Nate Lowrie wrote: > > On Dec 5, 2007 2:23 AM, johnf <[EMAIL PROTECTED]> wrote: > > > def _openDialog(self,evt): > > > # need to receive the evt (in this case a click or Hit) > > > theDialog=dabo.ui.dFileDialog(self) > > > theDialog.show() > > > > *************DELETE********************* > > > > > if sys.platform == 'win32': > > > myseperator = "\\" # some should post why I > > > needed two slashes else: > > > myseperator = "/" > > > > ****************DELETE******************* > > > > > myReturnFileValue= theDialog.FileName > > > myReturnDirectory = theDialog.Directory > > > > > > self.filename.Value= myReturnDirectory + myseperator + > > > myReturnFileValue > > > > Change the last line to: > > > > self.filename.Value = os.path.join(myReturnDirectory, myReturnFileValue) > > > > That is a more Pythonic fix than Uwe's... > > > > Cheers, > > > > Nate L. > > Please add a full description of why that works. Folks coming from other > languages know little about the os module. For example it needs to be > pointed out that the os module is platform aware. Also what ".join" is doing > and how it got there. From the private emails I'm getting it is obvious that > the newbies know little about python. I'll add your side bar to the wiki > when I post the thread and all the other sidebars.
Well, I figured that since it was part of the standard library and it was documented in the standard Python documentation that anyone that didn't know what it was could look it up. You should not have to explain language syntax and standard libraries to a person in these tutorials. There are plenty of references elsewhere that detail this. Looking up stuff is part of a programmer's everyday job. I don't know HALF of the standard library and have to look stuff up everyday, even though I have been coding Python for 3+ years. Just because a person may be new to Python and have to look up certain classes doesn't mean the code has to be altered to not use standard library classes. They are there and availabl, SO USE THEM!!! You are writing these tutorials so that people can produce good code when using Dabo. However, if you don't use the standard library functions or a specific syntax style in favor of something more easily understandable, are you really getting them to produce good code? Don't reinvent the wheel... Note that this isn't to knock on people that are new to Python. I was once new myself. However, if you are attempting to code a GUI with Dabo, I do expect you to need to learn at least the basics of Python in order for you to have success. Cheers, Nate L. _______________________________________________ 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]
