Re: [Tutor] help with list permutations

2008-01-03 Thread Chris Fuller
This is a good case for recursion. My solution is in two steps. A 
straightforward application of recursion (I was casting about semi-randomly) 
yields a attractive tree structure:

   root
   a  b
 c d e  c de
 f f f  f ff
g h   g h   g hg h   g h  g h

It returns a list, of course, but when unpacked in two dimensions looks like a 
tree. Trees are often represented this way in programming.

One thing to note is that the tree structure naturally preserves the order of 
the lists, as required.


Here is the code:

def recursion_is_your_friend(l):
   if len(l) == 1:
  return l
   else:
  return [ (i, recursion_is_your_friend(l[1:])) for i in l[0] ]

l = recursion_is_your_friend([['a','b'],['c','d','e'],['f'],['g','h']])


The idea is that each element of the first list in the list has all the rest of 
the lists applied to it. Something like that. Talking about recursion isn't a 
skill I have much skill in. Cue groaning!

The next step is to trace all the paths from the root to the leaves. There is a 
wikipedia page that discusses this: 
http://en.wikipedia.org/wiki/Depth-first_search. Stacks would seem a natural 
way to do this to me. It can also be done with more recursion. I may implement 
something a little later, but this should get you started. Another way to look 
at step two is to start at the leaves and follow the (unique) path back to the 
root.

Cheers
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Test

2008-01-03 Thread PyProg PyProg
It's just a test message

-- 
http://ekd.tolosano.info
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Review and criticism of python project

2008-01-03 Thread bob gailer
GTXY20 wrote:
>
> Hello all,
>
> Is there a forum or group where I can upload my python project for review?
Others on this list can guide you to web sites for uploading code.

If the program is relatively small you can just email it to this list as 
body text. How small? For me I'd rather wade thru 200 or so lines in an 
email.
>
> I am new at Python and at this point my program is doing what it needs 
> to I just can't help but feeling I have some errors
Errors? Do you mean bugs that have not yet surfaced but might under some 
conditions?
> or improper coding
Are you concerned about performance, readability & maintainability, 
easier / better ways to do things, conformance to Python coding 
guidelines, etc?

If so this is the right place to get suggestions.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Review and criticism of python project

2008-01-03 Thread bhaaluu
If you have a web page, you can upload the code to your web page,
then post here with a link to the code and a request for reviews.
That's one way to do it.
-- 
b h a a l u u at g m a i l dot c o m

On Jan 3, 2008 5:00 PM, GTXY20 <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> Is there a forum or group where I can upload my python project for review?
>
> I am new at Python and at this point my program is doing what it needs to I
> just can't help but feeling I have some errors or improper coding going on
> inside.
>
> Any advice is very much appreciated.
>
> Thanks.
>
> GTXY20
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Review and criticism of python project

2008-01-03 Thread GTXY20
Hello all,

Is there a forum or group where I can upload my python project for review?

I am new at Python and at this point my program is doing what it needs to I
just can't help but feeling I have some errors or improper coding going on
inside.

Any advice is very much appreciated.

Thanks.

GTXY20
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Marc Tompkins
Let me clarify this:

> But if, to achieve the proper level of proficiency with the designer, I
> have to invest many hours of study and practice... well, it's going to be a
> hard sell.  I'd rather be coding.
>

An hour spent learning something new in Python makes me a better programmer,
and probably a smarter, better human being.  An hour spent learning
something new in wxPython makes me a better GUI programmer, and probably
teaches me things I need to know about the OS and the desktop environment
I'm using.

An hour spent learning to use a designer had better pay me off with an hour
saved somewhere else, and that right soon, or else I'm going to feel I
wasted that hour.
-- 
www.fsrtechnologies.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Marc Tompkins
On Jan 3, 2008 1:24 PM, Tony Cappellini <[EMAIL PROTECTED]> wrote:

> The point I was trying to make that didn't come across is:
> Until one has enough experience to hand code the GUIs, the designers are
> helpful and a good place to begin.
>
> The problem with widgets not appearing where they should is not a problem
> with the GUI designer, but the lack experience with the particular toolkit
> by the programmer.


That's probably true.  But my philosophy is that tools shouldn't be more
complicated than the problem they're supposed to solve.
If it takes me half an hour to code a screen of my GUI by hand, and I could
do it in five minutes in a designer - and not spend an extra half hour after
that cleaning it up by hand - then hurrah for the designer.  Sign me up!
But if, to achieve the proper level of proficiency with the designer, I have
to invest many hours of study and practice... well, it's going to be a hard
sell.  I'd rather be coding.
-- 
www.fsrtechnologies.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Tony Cappellini
The point I was trying to make that didn't come across is:
Until one has enough experience to hand code the GUIs, the designers
are helpful and a good place to begin.

The problem with widgets not appearing where they should is not a
problem with the GUI designer, but the lack experience with the
particular toolkit by the programmer.


On Jan 3, 2008 1:00 PM, Marc Tompkins <[EMAIL PROTECTED]> wrote:
> On Jan 3, 2008 10:31 AM, Tony Cappellini <[EMAIL PROTECTED]> wrote:

> It's like OCR and speech-to-text.  At some point it becomes easier to do it
> by hand than to straighten out the dog's breakfast that the "labor-saving"
> tool made for you.
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Marc Tompkins
On Jan 3, 2008 10:31 AM, Tony Cappellini <[EMAIL PROTECTED]> wrote:

> Putting  widgets into sizers is easy with the designers. Not knowing how
> to fix your code when the widgets don't appear as you want them is a
> problem. I've never seen any docs written to help overcome this for any
> framework.


It's like OCR and speech-to-text.  At some point it becomes easier to do it
by hand than to straighten out the dog's breakfast that the "labor-saving"
tool made for you.

-- 
www.fsrtechnologies.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread Kent Johnson
johnf wrote:
> So I started thinking why would I need the class outside of the function.  If 
> I instead used "import class" would I get a performance improvement?  The 
> function creates an instance each time it is required and then releases and 
> closes.  
> 
> I am very interested in this possible difference between importing the class 
> vs using the inline class.

There is another possibility which is probably what I would do - just 
define the class at global scope in the same module that uses it. 
Instead of

def f():
   class Z(object):
 pass
   # do something with Z

write

def f():
   # do something with Z

class Z(object):
   pass


I.e. you don't have to put the class def'n in a separate module.
Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Kent Johnson
Alan Gauld wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote 
> 
>> I'm surprised no one else has chimed in for Dabo yet ;-)
> 
> You missed it!
> John F already did the Dabo recommendation.

Funny, I didn't miss it, for some reason I thought that was a different 
thread!

OK, back to my cave :-)

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] help with list permutations

2008-01-03 Thread c t
Greeting from a real newbie,

I think that their might exist an easy way, in Python, for my list
permutation issue. I need to be able to permute all elements from across
several lists, while ensuring order is maintained across the lists.

For example: list1=[a b]   list2=[c d e]  list3=[f]  list4=[g h]

permute(list1, list2, list3, list4) =

[ [a c f g], [a c f h], [a d f g], [a d f h], [a e f g], [a e f h],
  [b c f g], [b c f h], [b d f g], [b d f h], [b e f g], [b e f h] ]

Of course, the number of the lists is arbitrary and the size of each list is
also arbitrary.

Any help would be greatly appreciated.

thanks,
Bertha
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Tony Cappellini
Message: 1
Date: Thu, 3 Jan 2008 10:06:01 -0200
From: Tiago Saboga <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Choice of GUI builders
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

>>But since 2005, according to wikipedia, the Qt Windows is also
>>licensed under the GPL. Am I missing something?
There is a GPL version of QT, I believe it came into being for QT 3.x

>>t's why I finally started using Qt. In fact I do not really like
>>WYSIWYG designers -
There is a free designer for QT/PyQT as well. I started with qt/Pyqt
but have moved to wx since then.

Putting  widgets into sizers is easy with the designers. Not knowing
how to fix your code when the widgets don't appear as you want them is
a problem. I've never seen any docs written to help overcome this for
any framework.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Alan Gauld
"Marc Tompkins" <[EMAIL PROTECTED]> wrote

> on, and its idiom felt more comfortable to me than the others. 
> Also, unlike
> Qt, it's free... I hate to be a cheapskate, but I'm a very small 
> business
> and I need to put food on my family, so the Qt license is a major 
> hurdle.

Umm, so do the folks at TrollTech :-)

But I believe there are Free versions available for non-commercial use 
now.
But if you are putting food on your table then you also need to put
some on TrollTech's...

> I have to say, though, that as a recovering Visual Studio user there 
> is one
> thing - believe me, it's the only thing! - I miss, and that's an
> honest-to-goodness WYSIWYG GUI designer.

The Visual Studio one is not bad but it's taken Microsoft 15 years of
continuous development to get there. The early Visual C++ GUI Builder
(or Resource editor as it was then) was not much better than Glade.
It wasn't till VC v6 (after 7 years?) that they managed a decent GUI 
builder
and it was still poor at handling resize events etc.

And of course it only works for Windows...

If it takes MS that long charging money for the work its not that
surprising that OpenSource is taking longer to produce a good
product that works for all platforms..

> Why can't you just draw your GUI on the screen and concentrate on
> the actual functionality in peace?

Coz its hard! Especially taking into the platform variations and
the tricks needed to handle resizing etc. It requires a lot of
introspection of the widgets and dynamic drawing of the GUI.
Remember its not just gif files that you are placing on the designer
its real widgets on a real UI...

> In the wx world, I tried both PythonCard and wxGlade.

I agree with you about both...

> It's not really that hard, by the way.  Draw yourself a picture 
> ahead of
> time - on paper, or (as I do) with hyphens and pipe characters in 
> the
> comments - so you can keep straight which sizers go inside of which. 
> Then,
> build from the inside out.  And when you get weary - and oh, you 
> will get
> weary - indulge in just a little nostalgie de la bue.

And this. I use Delphi for all my heavy duty UI work and call a Python
server for the heavy processing. Thankfully I don;t do much heavy UI 
work!

Alan G. 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread johnf
On Thursday 03 January 2008 10:13:18 am Alan Gauld wrote:
> "johnf" <[EMAIL PROTECTED]> wrote
>
> >   If the user types in a partial of the key then the dialog
> > appears and the user picks from the list.  The details of the dialog
> > are
> > dynamic for each call (based on some meta data) of the showModal().
>
> This might be a valid case for defining the class in the function
> since
> it could be that the number of fields, the labels etc change depending
> on the input values. That is exactly the kind of place where a local
> class
> makes sense.
>
> > I am very interested in this possible difference between importing
> > the class
> > vs using the inline class.  Any thoughts as what the difference is
> > will help
> > me understand Python a little better.
>
> There is no great secret, its just that by putting the class
> definition
> into the function you have to execute the definition each time you
> execute the function. If you put the class in a module and import
> it then the class definition is executed at import time and thats it.
>
> But if you need to change the definition each time you instantiate the
> dialog you will have a very complex init method so you might find
> it easier to redefine the class each time instead.

Thanks for the response.  Having only a short period using python under my 
belt I find your type of help reassuring.

-- 
John Fabiani
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Marc Tompkins
On Jan 3, 2008 4:06 AM, Tiago Saboga <[EMAIL PROTECTED]> wrote:

> But since 2005, according to wikipedia, the Qt Windows is also
> licensed under the GPL. Am I missing something?
>
>From the Trolltech website:

> *Qt Open Source Edition* is provided under the GNU General Public License
> version 2.0 (GPL). You may use the Qt Open Source Edition for:
>
>- Development of open source/non-proprietary software that is also
>released under the GPL license.
>- Compiling and running GPL software developed by others.
>
> If you are writing commercial/proprietary software, or if you plan to
> commercialize the software you are writing with Qt, you must use a
> commercial version of Qt. Please refer to the Open Source 
> Downloadsinfo page for 
> reasons why.
>
-- 
www.fsrtechnologies.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] open email client from Help menu

2008-01-03 Thread Alan Gauld

"Kakada" <[EMAIL PROTECTED]> wrote

> In my program, I want to have "Report Bug..." under Help menu. So, 
> whenever
> user clicks on it, it will open an email client for reporting bugs 
> with the
> given address. How can I do this?

Which OS?
Which GUI toolkit?
Which email client?

You might be easier to write a dialog to capture the subject and 
message
text and use the Python email module to send the mail directly.


HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread Alan Gauld
"johnf" <[EMAIL PROTECTED]> wrote

>   If the user types in a partial of the key then the dialog
> appears and the user picks from the list.  The details of the dialog 
> are
> dynamic for each call (based on some meta data) of the showModal().

This might be a valid case for defining the class in the function 
since
it could be that the number of fields, the labels etc change depending
on the input values. That is exactly the kind of place where a local 
class
makes sense.

> I am very interested in this possible difference between importing 
> the class
> vs using the inline class.  Any thoughts as what the difference is 
> will help
> me understand Python a little better.

There is no great secret, its just that by putting the class 
definition
into the function you have to execute the definition each time you
execute the function. If you put the class in a module and import
it then the class definition is executed at import time and thats it.

But if you need to change the definition each time you instantiate the
dialog you will have a very complex init method so you might find
it easier to redefine the class each time instead.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote 

> I'm surprised no one else has chimed in for Dabo yet ;-)

You missed it!
John F already did the Dabo recommendation.
The downside is that it comes with its own variety of 
widget set on top of wxPython

But, it does look good and if I was starting from 
scratch I might give it a spin.

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread johnf
On Thursday 03 January 2008 12:22:25 am Alan Gauld wrote:
> Are you sure you made it a modal dialog?
> Any dialog will do that if it is opened modelessly, you need to
> use the modal version to make it block the app.

Yes.  I believe the way I have coded the dialog causes a bug.  If I create a 
static dialog and use showModal() it works as expected.
>
> Putting the class code in a functiion is legal but very inefficient
> and also prevents you from storing state etc in the dialog - you
> would need to reinitialise all valuues on each use. Thats OK if
> its simple but a lot of work(and slow)  if its complex.

I am creating a function that does a lookup of PK or FK fields.  If the user 
does type in the correct identifier then the dialog does not appear and is 
not created.  If the user types in a partial of the key then the dialog 
appears and the user picks from the list.  The details of the dialog are 
dynamic for each call (based on some meta data) of the showModal(). 

So I started thinking why would I need the class outside of the function.  If 
I instead used "import class" would I get a performance improvement?  The 
function creates an instance each time it is required and then releases and 
closes.  

I am very interested in this possible difference between importing the class 
vs using the inline class.  Any thoughts as what the difference is will help 
me understand Python a little better.

-- 
John Fabiani
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Kent Johnson
Tony Cappellini wrote:

>>> OK, wxPython is a fine toolkt. Just be aware that it does not have a GUI
>>> builder per se, you have to write the GUI as source code or use a
>>> third party GUI builder.

> It's a shame that someone with adequate resources doesn't come up with
> a nice commercial WYSIWIG builder for wx, in the same light as Visual
> Basic, Delphi, or C++ Builder, (but with Python code generation &
> event handler management.)

I'm surprised no one else has chimed in for Dabo yet ;-)
Dabo has a UI designer and it is intended specifically for refugees from 
Visual FoxPro and VB. Dabo is kind of marginal as far as 'adequate 
resources' though; the docs are sorely lacking. Most of the 
documentation is in the screencasts AFAICT. Those who invest the effort 
to figure it out (not me, not yet) seem to like it, though.
http://dabodev.com/

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Tony Cappellini
Message: 1
Date: Thu, 3 Jan 2008 08:11:05 -
From: "Alan Gauld" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Choice of GUI builders
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
   reply-type=original


>>OK, wxPython is a fine toolkt. Just be aware that it does not have a GUI
>>builder per se, you have to write the GUI as source code or use a
>>third party GUI builder.


The Add-Ons & Demos for wxPython come with Xrced, which is a GUI
builder for wx, but is not the GUI builder we all think of (VB,
Delphi, C++ Builder, etc)
There are a handlfull of GUI builders for wx, all with varying degrees
of pain & pleasure.
wxDesigner,wxFormBuilder, BoaConstructor, Pythoncard are all builders
for wx, but not all support Python code generation.

I agree with Marc Tompkins" <[EMAIL PROTECTED]> comments and
like wx more than other GUI frameworks.
It's a shame that someone with adequate resources doesn't come up with
a nice commercial WYSIWIG builder for wx, in the same light as Visual
Basic, Delphi, or C++ Builder, (but with Python code generation &
event handler management.)

BTW- There is a list dedicated for wxPython users & development that
is extremely help for questions related to wx.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How to convert ogg to MP3

2008-01-03 Thread János Juhász
> "goldgod a" <[EMAIL PROTECTED]> wrote in

> >I would like to convert ogg files to mp3 files. how can I do
> > that.
> > Is there any inbuilt package.
> 
> I think Lame can do that.
> You would need to access Lame via its command line (using the
> subprocess module?) or maybe someone has a python library
> to use the lame library/DLL directly.

Pymedia promises to do that. (http://pymedia.org/)
There is a sample script about it called recode_audio.py,
but it chrashed my python interpreter on xp, when I tried to convert from 
ogg to mp3.


Best Regards,
Janos___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Tiago Saboga
On Thu, Jan 03, 2008 at 02:11:03AM -0800, Marc Tompkins wrote:
> on, and its idiom felt more comfortable to me than the others.  Also, unlike
> Qt, it's free... I hate to be a cheapskate, but I'm a very small business
> and I need to put food on my family, so the Qt license is a major hurdle.

But since 2005, according to wikipedia, the Qt Windows is also
licensed under the GPL. Am I missing something?

> 
> I have to say, though, that as a recovering Visual Studio user there is one
> thing - believe me, it's the only thing! - I miss, and that's an
> honest-to-goodness WYSIWYG GUI designer.  For the love of Pete, if Microsoft
> can get it right - and it's the only thing they did get right, IMHO - why
> can't we?  Why can't you just draw your GUI on the screen and concentrate on
> the actual functionality in peace?

It's why I finally started using Qt. In fact I do not really like
WYSIWYG designers - I always remember html produced by Dreamweaver and
co. - but qtdesigner + pyuic (see pyqt) always gave me readable code. 

Tiago Saboga.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Marc Tompkins
I'm using wxPython, after very brief forays into Tk and Qt, and I like it a
lot. wx generally wraps the native widgets of whatever OS/desktop it runs
on, and its idiom felt more comfortable to me than the others.  Also, unlike
Qt, it's free... I hate to be a cheapskate, but I'm a very small business
and I need to put food on my family, so the Qt license is a major hurdle.


I have to say, though, that as a recovering Visual Studio user there is one
thing - believe me, it's the only thing! - I miss, and that's an
honest-to-goodness WYSIWYG GUI designer.  For the love of Pete, if Microsoft
can get it right - and it's the only thing they did get right, IMHO - why
can't we?  Why can't you just draw your GUI on the screen and concentrate on
the actual functionality in peace?

In the wx world, I tried both PythonCard and wxGlade.  PythonCard might be
OK, but I didn't like it a bit; its stated goal is to be a re-creation of
HyperCard, and I was never a fan.  Also, I tried it just as I was first
getting started with Python, and it sorta felt at odds with the gestalt of
the language.  I'm probably not being fair to it.  Ah well.

wxGlade wants to re-create the joys of working with Glade, but I've never
used Glade. If it's anything like wxGlade, I'm glad to have missed out.
wxGlade does some very nifty, sophisticated and impressive GUI work to
create, for your delectation, a representation of your GUI that looks
virtually nothing like the finished product.  Looking at the display
mid-process, you can neither see what the finished product will look like,
nor what the code will look like.  Along the way, there's a hierarchical
organizer thingy that in theory should help you to put widgets inside of the
frames, panels and sizers that contain them, but in my experience actually
tends to put them at the same hierarchical level and refuses to let you fix
any mistakes you might make.  I've tried it four or five times - every time
I get tired of wxCoding by hand - and each time I realize it's going to be
easier to do it by hand.

It's not really that hard, by the way.  Draw yourself a picture ahead of
time - on paper, or (as I do) with hyphens and pipe characters in the
comments - so you can keep straight which sizers go inside of which.  Then,
build from the inside out.  And when you get weary - and oh, you will get
weary - indulge in just a little nostalgie de la bue.




On Jan 3, 2008 12:11 AM, Alan Gauld <[EMAIL PROTECTED]> wrote:

>
> "Roy Chen" <[EMAIL PROTECTED]> wrote
>
> > I suppose with any GUI toolkit/builder, you're going to have learn
> > some part
> > of the API anyway. I might just see how I go with wxPython for now.
>
> OK, wxPython is a fine toolkt. Just be aware that it does not have a
> GUI
> builder per se, you have to write the GUI as source code or use a
> third
> party GUI builder.
>
> Alan G.
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
www.fsrtechnologies.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] open email client from Help menu

2008-01-03 Thread Kakada
Hi every one,

In my program, I want to have "Report Bug..." under Help menu. So, whenever 
user clicks on it, it will open an email client for reporting bugs with the 
given address. How can I do this? 

I set text to actionReportBug like this:
Report Bug...
but it doesn't support html tag.

Any method?

dada
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread Alan Gauld

"johnf" <[EMAIL PROTECTED]> wrote

> 1 and 3 are my reasons.  I'm creating a Dabo app.  When I attempted 
> to create
> a special class that contained a dialog box I discovered that the 
> dialog
> class created an indepentant type of window and allowed my program 
> to
> continue running without waiting for the dialog to return a value 
> first.

Are you sure you made it a modal dialog?
Any dialog will do that if it is opened modelessly, you need to
use the modal version to make it block the app.

Putting the class code in a functiion is legal but very inefficient
and also prevents you from storing state etc in the dialog - you
would need to reinitialise all valuues on each use. Thats OK if
its simple but a lot of work(and slow)  if its complex.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to convert ogg to MP3

2008-01-03 Thread Alan Gauld

"goldgod a" <[EMAIL PROTECTED]> wrote in

>I would like to convert ogg files to mp3 files. how can I do 
> that.
> Is there any inbuilt package.

I think Lame can do that.
You would need to access Lame via its command line (using the
subprocess module?) or maybe someone has a python library
to use the lame library/DLL directly.

Try googling "python lame" - I'm too lazy :-)

Alan G 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread Alan Gauld

"bob gailer" <[EMAIL PROTECTED]> wrote

> So the question becomes "why would you want to do that?"

The main reason I could think of was to create a factory 
method for dynamically creating classes based on input 
parameters - for example currency convertors or similar.
Equally you could change method implementations 
by passing lambdas etc.

Useful in certain other languages but much less so in 
Python which allows dynamic changes to classes/objects 
after creation anyway.

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] is it legal to have a class within a def

2008-01-03 Thread Alan Gauld

"johnf" <[EMAIL PROTECTED]> wrote 

> def someMethod():
>   class MyClass(object):
>   .
>  if something:
> .
> return someval


Did you try it?

>>> def f():
...   class C: pass
...   return C
...
>>> def g(x):
...   class C: pass
...   if x == 42:
... return C
...   else: return 666
...
>>> c = f()
>>> c

>>>

It works for me...


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Alan Gauld

"Roy Chen" <[EMAIL PROTECTED]> wrote

> I suppose with any GUI toolkit/builder, you're going to have learn 
> some part
> of the API anyway. I might just see how I go with wxPython for now.

OK, wxPython is a fine toolkt. Just be aware that it does not have a 
GUI
builder per se, you have to write the GUI as source code or use a 
third
party GUI builder.

Alan G. 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor