Re: [Code Challenge] WxPython versus Tkinter.

2011-01-23 Thread Stefan Behnel

rantingrick, 23.01.2011 01:07:

I have in many threads declared that Tkinter (and TclTk) is currently
--and has been for a decade-- the wrong choice for Python's stdlib
GUI.  [...]
It is time to prove once and for all how dated and worthless Tkinter
is compared to wxPython.


What's the aim of that prove? If you are trying to pave the ground for 
getting wxPython in the stdlib instead of tkinter, I think that's bound to 
fail. Similar proposals have been rejected with the simple argument that 
adding a large library with a huge C dependency to the standard library 
without having a rock solid maintainer for both of them is not going to happen.


Are you volunteering to maintain both wxPython and wxWidgets in the 
standard library for, say, twenty years to come?


Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rusi
On Jan 23, 5:07 am, rantingrick  wrote:
> WxPython versus Tkinter (A code battle to the death!)
>
> by Rick Johnson.
>
> I have in many threads declared that Tkinter (and TclTk) is currently
> --and has been for a decade-- the wrong choice for Python's stdlib
> GUI. Throughout the 90's Tkinter was fine. However we have been in the
> 21st century for more than a decade and Tkinter is no longer relevant.
> Many people have argued (weakly) that Tkinter is still valid. However
> their arguments have been mostly baseless opinions that sadly lack
> vision for the future.
>
> In this thread i intend to slay my enemies with cold hard facts based
> on code. It is time to put your code where your mouth is (or you
> foot). This will be an open challenge to *anyone* in this community,
> in the world, and *even* the great Guido van Rossum himself! It is now
> time for you (python community) to prove the worth of Tkinter or
> accept its demise at my hands!
>
> Some of you may think this sounds like an impossible challenge. How
> can one man defend his position against the entire world! Yes, it
> would seem impossible for one man to face an entire community in open
> challenge! And in most cases only a fool would challenge the world.
> However, i have not one ounce of fear within me while facing these
> odds because my position is the correct position. My position is based
> on facts and NOT friendship, truth and NOT tantrums, and finally
> vision NOT vengance! I am on the correct side of history!
>
> It is time to prove once and for all how dated and worthless Tkinter
> is compared to wxPython. Yes, WxPython is not as advanced as i would
> like it to be for a 21st century GUI library. However compared to
> Tkinter, Wx is light years ahead! Wx is our best hope to move Python
> into the 21st century.
>
> So now is the time for all you naysayers, trolls, and minions to face
> me in mortal combat within the arena of truth and righteousness. Ready
> your minds and wield your text editors for we shall battle for the
> glory of Python! And when i have slayed the fools with their own
> foolishness then ye all shall be enlightened!
>
> So PUT UP OR SHUT THE HELL UP!
>
> ---
>  Challenge 1: (Simple Directory Viewer)
> ---
>
> Create a simple Directory Viewer GUI. You CANNOT use a treectrl!  The
> point of this challenge is to show that Tkinter has no support for a
> true ListCtrl widget. However the Wx::ListCtrl is fully featured! For
> wxPython the code is simply wielding a few built in classes. For
> Tkinter no such ListCtrl functionality exists. You CAN create the
> functionality yourself (and i know this because i HAVE created it!)
> however it involves tons of work and still can't hold a candle to the
> wx::ListCtrl
>
> ---
>  Requirements:
> ---
>
> How the user navigates to a folder is not important but you must
> display the list of files/folders in two view modes with icons;
>
>  1. Display files in both ReportView and ListView.
>
>   * Reportview:
>     ...scrollable vertical list with three columns.
>
>   * Listview:
>     ...scrollable horizontal-ly wrapping list.
>
> Note: If you do not understand the view modes just run my code for an
> example. But the user must be able to switch between these two modes
> easily. How the switching is done is unimportant -- I simply used two
> buttons.
>
>  2. Columns
>   * Minimum of three cols; Name, Size, and Type (reportview).
>   * the "Name" column must include an icon AND label (both views).
>   * columns must be sortable by the user (reportview).
>   * columns must be sizable by the user (reportview).
>
>  3. Items
>   * All must be editable in place (no popup editing allowed!).
>   * All items must be selectable/deselectable by user.
>   * All items must be delete-able by the user.
>
> That is the challenge. Step forth and battle if you can!
>
> -
>  WxPython code:
> -
>
> https://sites.google.com/site/thefutureofpython/home/code-challenges
>
> I await any challengers...

Tried the code with debian sid and default python (2.6)

I get (after some loading... statements)

Segmentation fault

[Actually this is the first time in my 10 years of python that Ive
seen a pure python module segfault :-) ]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Steven D'Aprano
On Sun, 23 Jan 2011 02:18:34 -0800, rusi wrote:

>>  WxPython code:
[...] 
> Tried the code with debian sid and default python (2.6)
> 
> I get (after some loading... statements)
> 
> Segmentation fault
> 
> [Actually this is the first time in my 10 years of python that Ive seen
> a pure python module segfault :-) ]

wxPython is a front end to the wxWidgets (formerly wxWindows) toolkit, 
which is C++. I imagine that's what seg faulted.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Adam Skutt
On Jan 22, 7:07 pm, rantingrick  wrote:
> So PUT UP OR SHUT THE HELL UP!

You first.  Write actual working code first and then you can challenge
people. I found 5 bugs in your code before I quit looking[1].  Can you
find and fix them all?  Also, I'm entirely ignoring the bad styling,
bad default sizing, horrible UI, the fact you call rename "Edit", and
the fact the context menu doesn't do anything.  All of the are
legitimate technical errors, i.e., you coded the program wrong.

In the spirit of community I open the bug finding to everyone, but
humbly ask you don't tell Mr. "rantingrick" Johnson about them.  It
can be our little secret ;)

Adam

[1] I think there might even be more, but I got lazy.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which non SQL Database ?

2011-01-23 Thread Roy Smith
In article ,
 Deadly Dirk  wrote:
 
> The same thing applies to MongoDB which is equally fast but does allow ad 
> hoc queries and has quite a few options how to do them. It allows you to 
> do the same kind of querying as RDBMS software, with the exception of 
> joins. No joins.

Well, sort of.  You can use forEach() to get some join-like 
functionality.  You don't get the full join optimization that SQL gives 
you, but at least you get to do some processing on the server side so 
you don't have to ship 40 gazillion records over the network to pick the 
three you wanted.

> It also allows map/reduce queries using JavaScript and 
> is not completely schema free.

What do you mean by "not completely schema free"?

> Databases have sub-objects called "collections" which can be indexed 
> or partitioned across several machines ("sharding"), which is an 
> excellent thing for building shared-nothing clusters. 

We've been running Mongo 1.6.x for a few months.  Based on our 
experiences, I'd say sharding is definitely not ready for prime time.  
There's two issues; stability and architecture.

First, stability.  We see mongos (the sharding proxy) crash a couple of 
times a week.  We finally got the site stabilized by rigging upstart to 
monitor and automatically restart mongos when it crashes.  Fortunately, 
mongos crashing doesn't cause any data loss (at least not that we've 
noticed).  Hopefully this is something the 10gen folks will sort out in 
the 1.8 release.

The architectural issues are more complex.  Mongo can enforce uniqueness 
on a field, but only on non-sharded collection.  Security (i.e. password 
authentication) does not work in a sharded environment.  If I understand 
the release notes correctly, that's something which may get fixed in 
some future release.

> Scripting languages like Python are 
> very well supported and linked against MongoDB

The Python interface is very nice.  In some ways, the JS interface is 
nicer, only because you can get away with less quoting, i.e.

JS:   find({inquisition: {$ne: 'spanish'}}
Py:   find({'inquisition': {'$ne': 'spanish'}}

The PHP interface is (like everything in PHP), sucky:

PHP:  find(array('inquisition' => array('$ne' => 'spanish'))

The common thread here is that unlike SQL, you're not feeding the 
database a string which it parses, you're feeding it a data structure.  
You're stuck with whatever data structure syntax the host language 
supports.  Well, actually, that's not true.  If you wanted to, you could 
write a front end which lets you execute:

  "find where inquisition != spanish"

and have code to parse that and turn it into the required data 
structure.  The odds of anybody doing that are pretty low, however.  It 
would just feel wrong.  In much the same way that SQLAlchemy's 
functional approach to building a SQL query just feels wrong to somebody 
who knows SQL.

> I find MongoDB well suited for what is 
> traditionally known as data warehousing.

I'll go along with that.  It's a way to build a fast (possibly 
distributed, if they get sharding to work right) network datastore with 
some basic query capability.  Compared to SQL, you end up doing a lot 
more work on the application side, and take on a lot more of the 
responsibility to enforce data integrity yourself.

> You may want to look 
> at this Youtube clip entitled "MongoDB is web scale":
> 
> http://www.youtube.com/watch?v=b2F-DItXtZs

That's the funniest thing I've seen in a long time.  The only sad part 
is that it's all true.

There are some nice things to NO-SQL databases (particularly the 
schema-free part).  A while ago, we discovered that about 200 of the 
300,000 documents in one of our collections were effectively duplicates 
of other documents ("document" in mongo-speak means "record" or perhaps 
"row" in SQL-speak).  It was trivial to add "is_dup_of" fields to just 
those 200 records, and a little bit of code in our application to check 
the retrieved documents for that field and retrieve the pointed-to 
document.  In SQL, that would have meant adding another column, or 
perhaps another table.  Either way would have been far more painful than 
the fix we were able to do in mongo.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 05:18 AM, rusi wrote:


Tried the code with debian sid and default python (2.6)

I get (after some loading... statements)

Segmentation fault

[Actually this is the first time in my 10 years of python that Ive
seen a pure python module segfault :-) ]


I also have a segfault. You should fix that, rantingrick :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 22, 9:39 pm, Terry Reedy  wrote:
> On 1/22/2011 7:07 PM, rantingrick wrote:
>
> Near the beginning of this thread, I gently challenged you to produce a
> concrete, practical proposal for an stdlib addition that could be
> critiqued and improved. When you asked for problems with
> wxwidgets/wxpython, I gave some. Still waiting.

You may have done this however i do not remember. With all the
trolling that was going on (not you) i may have missed it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 1:53 am, "Octavian Rasnita"  wrote:

> I have downloaded that simple program, launched it, and I've tested it with 
> JAWS screen reader.
> It was fully accessible out of the box.

Excellent!

> Have you done something special for making it accessible for screen readers? 
> (I guess not).

I did nothing to make the code more accessible, that is just another
great attribute of 21st cenury GUI libraries.

> Can be the same thing done with Tkinter?

Not that i am aware of.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Code Challenge] WxPython versus Tkinter.

2011-01-23 Thread Arndt Roger Schneider

rantingrick schrieb:

[snip]

1. You cannot define the terms--restrict your opponent--
   and battle it yourselves.
2. Your specified directory browser is useless.
   --At least define that the directory browser must have
 constant complexity to work with volatile
 data over a network...

-roger

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 4:18 am, rusi  wrote:
> On Jan 23, 5:07 am, rantingrick  wrote:
>
>
>
>
>
>
>
>
>
> > WxPython versus Tkinter (A code battle to the death!)
>
> > by Rick Johnson.
>
> > I have in many threads declared that Tkinter (and TclTk) is currently
> > --and has been for a decade-- the wrong choice for Python's stdlib
> > GUI. Throughout the 90's Tkinter was fine. However we have been in the
> > 21st century for more than a decade and Tkinter is no longer relevant.
> > Many people have argued (weakly) that Tkinter is still valid. However
> > their arguments have been mostly baseless opinions that sadly lack
> > vision for the future.
>
> > In this thread i intend to slay my enemies with cold hard facts based
> > on code. It is time to put your code where your mouth is (or you
> > foot). This will be an open challenge to *anyone* in this community,
> > in the world, and *even* the great Guido van Rossum himself! It is now
> > time for you (python community) to prove the worth of Tkinter or
> > accept its demise at my hands!
>
> > Some of you may think this sounds like an impossible challenge. How
> > can one man defend his position against the entire world! Yes, it
> > would seem impossible for one man to face an entire community in open
> > challenge! And in most cases only a fool would challenge the world.
> > However, i have not one ounce of fear within me while facing these
> > odds because my position is the correct position. My position is based
> > on facts and NOT friendship, truth and NOT tantrums, and finally
> > vision NOT vengance! I am on the correct side of history!
>
> > It is time to prove once and for all how dated and worthless Tkinter
> > is compared to wxPython. Yes, WxPython is not as advanced as i would
> > like it to be for a 21st century GUI library. However compared to
> > Tkinter, Wx is light years ahead! Wx is our best hope to move Python
> > into the 21st century.
>
> > So now is the time for all you naysayers, trolls, and minions to face
> > me in mortal combat within the arena of truth and righteousness. Ready
> > your minds and wield your text editors for we shall battle for the
> > glory of Python! And when i have slayed the fools with their own
> > foolishness then ye all shall be enlightened!
>
> > So PUT UP OR SHUT THE HELL UP!
>
> > ---
> >  Challenge 1: (Simple Directory Viewer)
> > ---
>
> > Create a simple Directory Viewer GUI. You CANNOT use a treectrl!  The
> > point of this challenge is to show that Tkinter has no support for a
> > true ListCtrl widget. However the Wx::ListCtrl is fully featured! For
> > wxPython the code is simply wielding a few built in classes. For
> > Tkinter no such ListCtrl functionality exists. You CAN create the
> > functionality yourself (and i know this because i HAVE created it!)
> > however it involves tons of work and still can't hold a candle to the
> > wx::ListCtrl
>
> > ---
> >  Requirements:
> > ---
>
> > How the user navigates to a folder is not important but you must
> > display the list of files/folders in two view modes with icons;
>
> >  1. Display files in both ReportView and ListView.
>
> >   * Reportview:
> >     ...scrollable vertical list with three columns.
>
> >   * Listview:
> >     ...scrollable horizontal-ly wrapping list.
>
> > Note: If you do not understand the view modes just run my code for an
> > example. But the user must be able to switch between these two modes
> > easily. How the switching is done is unimportant -- I simply used two
> > buttons.
>
> >  2. Columns
> >   * Minimum of three cols; Name, Size, and Type (reportview).
> >   * the "Name" column must include an icon AND label (both views).
> >   * columns must be sortable by the user (reportview).
> >   * columns must be sizable by the user (reportview).
>
> >  3. Items
> >   * All must be editable in place (no popup editing allowed!).
> >   * All items must be selectable/deselectable by user.
> >   * All items must be delete-able by the user.
>
> > That is the challenge. Step forth and battle if you can!
>
> > -
> >  WxPython code:
> > -
>
> >https://sites.google.com/site/thefutureofpython/home/code-challenges
>
> > I await any challengers...
>
> Tried the code with debian sid and default python (2.6)
>
> I get (after some loading... statements)
>
> Segmentation fault
>
> [Actually this is the first time in my 10 years of python that Ive
> seen a pure python module segfault :-) ]

Congratulations genius! However if you are really smart you would have
read the note in the source that says "tested on windows only!".
Segfault. Thanks for the laugh!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 7:35 am, Adam Skutt  wrote:
> On Jan 22, 7:07 pm, rantingrick  wrote:

> You first.  Write actual working code first and then you can challenge
> people.

The code does work. You just lack the skill to run it.

> I found 5 bugs in your code before I quit looking[1].

What are these "so-called" bugs exactly? Remember this code is not
meant to WOW anyone. It is a challenge to anybody who can reproduce
the same functionality in Tkinter. The main point is to create a
ListCtrl that has two view modes, icons, and editable items. You lack
simple reading and comprehension skills Adam.

> Can you
> find and fix them all?  Also, I'm entirely ignoring the bad styling,

This is not a challenge about code styling.

> bad default sizing,

This is not a challenge about pretty GUIs.

>  horrible UI, the fact you call rename "Edit",

pedantic troll!

>  and
> the fact the context menu doesn't do anything.

THIS IS A SIMPLE EXAMPLE FILE VIEWER. We don't to actually rename and
delete files you moron. Get a life.

Adam you were one of the biggest trolls in the "other" thread. We
don't need you trolling up this one too. Can you write any code? I
have produced code and no one has offered a rebuttal using the Tkinter
module. This is because only a handful of the entire community has the
skills to create something like this with Tkinter. I am one of them,
Kevin is another, Guido is another, and there are a very few more.
HOWEVER YOU ARE NOT IN THIS GROUP ADAM. You are a troll, and that is
all you can do. Prove me wrong if you can...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 4:10 am, Stefan Behnel  wrote:
> rantingrick, 23.01.2011 01:07:
>
> > I have in many threads declared that Tkinter (and TclTk) is currently
> > --and has been for a decade-- the wrong choice for Python's stdlib
> > GUI.  [...]
> > It is time to prove once and for all how dated and worthless Tkinter
> > is compared to wxPython.
>
> What's the aim of that prove? If you are trying to pave the ground for
> getting wxPython in the stdlib instead of tkinter, I think that's bound to
> fail. Similar proposals have been rejected with the simple argument that
> adding a large library with a huge C dependency to the standard library
> without having a rock solid maintainer for both of them is not going to 
> happen.

Wait a minute, i am confused? What language is Python written in? Oh
thats right Lisp! I am so dumb. How did i even get this job? :-)

> Are you volunteering to maintain both wxPython and wxWidgets in the
> standard library for, say, twenty years to come?

WxPython needs lots of proper documentation aimed at beginners (so
does Tkinter!). WxPython also needs a better API (however only VERY
sightly!!). These are some areas where i can be very helpful.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 11:06 am, Arndt Roger Schneider 
wrote:
> rantingrick schrieb:
>
> [snip]
>
> 1. You cannot define the terms--restrict your opponent--
>     and battle it yourselves.
> 2. Your specified directory browser is useless.
>     --At least define that the directory browser must have
>       constant complexity to work with volatile
>       data over a network...
>
> -roger

Get a life moron and post some code, if you can!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 22, 6:07 pm, rantingrick  wrote:

> I await any challengers...


So far only trolls (besides Terry, Octavian, D'Aprano) have replied.
In my time here within the Python community i have only met one person
who shares my in-depth knowledge of Tkinter. That person is Kevin
Waltzer. So outside of Python-dev and Guido. Kevin and I are are the
ONLY people qualified to offer opinions on the worth or worthlessness
of Tkinter. If anyone in this entire community thinks that they also
are qualified then prove your worth by creating a ListCtrl in Tkinter
that mirrors the wxPython ListCtrl in functionality. When you have
done that, i will elevate you to my circle of enlightenment. Than and
only then shall i even entertain you BS.

Until then, anyone who tries to devalue my argument is just an
ignorant troll.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need GUI pop-up to edit a (unicode ?) string

2011-01-23 Thread Grant Edwards
On 2011-01-22, Corey Richardson  wrote:

> If that is all you need, I suggest Tkinter. Nice and easy, comes built 
> into Python.

In some Linux distros, that is.  Not in all of them.

-- 
Grant
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Steven D'Aprano
On Sun, 23 Jan 2011 09:31:25 -0800, rantingrick wrote:

> So far only trolls (besides Terry, Octavian, D'Aprano) have replied.

So apart from the non-trolls, only trolls have replied?



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Steven D'Aprano
On Sun, 23 Jan 2011 09:21:57 -0800, rantingrick wrote:

> Wait a minute, i am confused? What language is Python written in? Oh
> thats right Lisp! I am so dumb. How did i even get this job? :-)

Python is written in C, Java, C#, Javascript, Haskell, Ocaml, and, yes, 
even Lisp. There's even a Python interpreter written in Python. 
Admittedly, the Ocaml implementation seems to be abandoned, and some of 
the others are more experimental, but they're all Python.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Adam Skutt
On Jan 23, 12:21 pm, rantingrick  wrote:
> The code does work. You just lack the skill to run it.

I not only possess the skill to run it, but to find fault it in
through simple inspection.  All of the bugs I found, but one, I found
through reading the .py file. Heck, I'm so good that I guessed two of
the bugs before I downloaded the code because both are rank amateur
mistakes, and I'm not convinced you even rise to the level of amateur.

>
> What are these "so-called" bugs exactly?

1. There's a bug related to loading of your resources.
2. There's a bug related to when file I/O is performed.
3/4. There's at least two bugs related to handling of a specific mouse
event.
5. There's a bug related to reporting errors to the user.

All of these bugs, except one[1], show a grave misunderstanding about
how GUI toolkits operate and/or how the underlying operating systems
behave.

>Remember this code is not meant to WOW anyone.

That's apparent from simple inspection of the code!  Not only does it
not wow, it doesn't even illustrate your own example to a degree that
could be reasonably considered competent.  It demonstrates you didn't
even test the functionality you provided in your own code, or that if
you did, you're entirely clueless about GUI design fundamentals.

> The main point is to create a
> ListCtrl that has two view modes, icons, and editable items. You lack
> simple reading and comprehension skills Adam.

And your code will not do that in a whole host of common situations
that a GUI application is reasonably expected to handle.  It is not
sufficiently robust to be interesting.

> Adam you were one of the biggest trolls in the "other" thread. We
> don't need you trolling up this one too. Can you write any code? I
> have produced code and no one has offered a rebuttal using the Tkinter
> module. This is because only a handful of the entire community has the
> skills to create something like this with Tkinter.

No, it's because your code is complete and utter shite and there's
zero point in attempting to replicate it.  Your code does not work,
even if you think it does.  I'm not the only person who's noted this.

> HOWEVER YOU ARE NOT IN THIS GROUP ADAM. You are a troll, and that is
> all you can do. Prove me wrong if you can...

I already have.  Confirmation of some of the bugs I've noted exists in
this very thread.  Thus, I'm quite capable of reading and
comprehending Python code.  The same remains to be seen with you.

Adam

[1] Which is only because wxWidgets has a bug in this regard.  That
being said, a workaround exists and trivial to find online.
-- 
http://mail.python.org/mailman/listinfo/python-list


documentation / reference help

2011-01-23 Thread Scott Meup
I'm trying tolearn Python.  The documentation tells syntax, and other things 
about a command.  But for too many commands, it doesn't tell what it does. 
for instance, in VB the 'return' command tells the program what line to 
execute after some event (usually an error). In Python it appears to return 
a value.  Where does it return it to?  I couldn't find anywhere on the 
Python website to find out or to ask Python to upgrade their documentation. 
Can somebody please recommend a source. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 12:09 pm, Adam Skutt  wrote:
> On Jan 23, 12:21 pm, rantingrick  wrote:

> > What are these "so-called" bugs exactly?
>
> 1. There's a bug related to loading of your resources.
> 2. There's a bug related to when file I/O is performed.
> 3/4. There's at least two bugs related to handling of a specific mouse
> event.
> 5. There's a bug related to reporting errors to the user.

Well then post a traceback.

 However you still miss the point. You will do anything to distract
from the point. And what IS that point? Well that Tkinter is
lackluster 20 years old rotware and you need to resort to these BS
tactics to discredit me because 1). You cannot even create a Tkinter
GUI at the basic level, and 2) you have no real argument based on
facts!

Post CODE Adam. Code! Surely you can handle copy/pasting a traceback i
hope!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: documentation / reference help

2011-01-23 Thread Littlefield, Tyler
The return value simply returns a value to the calling function, which 
the function can handle, however it wants. so: for example

def add(a, b):
  return (a+b)

That simply returns the value a+b, which you can use however you like, 
like so: i=add(2,3) will assign the return value to add.


I recommend you check out the tutorial on python.org, which explains all 
of this; the documentation does not need updating, at least not in that 
respect.

On 1/23/2011 11:41 AM, Scott Meup wrote:

I'm trying tolearn Python.  The documentation tells syntax, and other things
about a command.  But for too many commands, it doesn't tell what it does.
for instance, in VB the 'return' command tells the program what line to
execute after some event (usually an error). In Python it appears to return
a value.  Where does it return it to?  I couldn't find anywhere on the
Python website to find out or to ask Python to upgrade their documentation.
Can somebody please recommend a source.





--

Thanks,
Ty

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Adam Skutt
On Jan 23, 2:07 pm, rantingrick  wrote:
> Well then post a traceback.

None of these issues will supply a traceback; in fact, in some of
these cases, you went out of your way to ensure that would not
happen.  That's an additional bug (or 5 additional bugs depending how
mean your tester/QA staff are).

>  However you still miss the point. You will do anything to distract
> from the point. And what IS that point? Well that Tkinter is
> lackluster 20 years old rotware

The fact it doesn't provide a control found almost exclusively in file
browsers and open/save dialogs does not mean that it is "20 years old
rotware".

> and you need to resort to these BS tactics to discredit me because 1). You 
> cannot even create a Tkinter
> GUI at the basic level,

I certainly can, but there's no point in demonstrating my skill when
you cannot create a wxWidgets GUI at a basic level.  You made the
challenge, you intentionally styled it as "rantingrick v. the world",
so you need to actually bring something challenge worthy to the table
first.

That includes picking a challenge that's interesting and not over a
relatively minor widget in the grand scheme of things.  Qt, Swing,
Gtk, and Win32 common controls[1] don't provide the same exact control
either, should we view it as deficient?

But regardless of the challenge, I don't think you're capable of
posting a worthwhile example, which is why you dismiss all the
problems found with it instead of actually fixing the code.

> Post CODE Adam. Code! Surely you can handle copy/pasting a traceback i
> hope!

I certainly can.  I don't have much hope for you writing code that
provides tracebacks, much less actually useful ones.

Adam

[1] Hell, I'm not sure /any/ toolkit provides the whole of wxListCtrl
functionality OOB, besides wxWidgets itself.  Like I said, it's
specific functionality isn't well suited.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: documentation / reference help

2011-01-23 Thread Emile van Sebille

On 1/23/2011 10:41 AM Scott Meup said...

I'm trying tolearn Python.  The documentation tells syntax, and other things
about a command.  But for too many commands, it doesn't tell what it does.
for instance, in VB the 'return' command tells the program what line to
execute after some event (usually an error). In Python it appears to return
a value.  Where does it return it to?  I couldn't find anywhere on the
Python website to find out or to ask Python to upgrade their documentation.
Can somebody please recommend a source.





If you've had any programming experience or can otherwise make sense of 
it, start with the tutorial at http://docs.python.org/tutorial/ 
otherwise there're good resource links at 
http://wiki.python.org/moin/BeginnersGuide to get you started.


Emile

--
http://mail.python.org/mailman/listinfo/python-list


Re: documentation / reference help

2011-01-23 Thread CM
On Jan 23, 2:38 pm, "Littlefield, Tyler"  wrote:
> The return value simply returns a value to the calling function, which
> the function can handle, however it wants. so: for example
> def add(a, b):
>    return (a+b)
>
> That simply returns the value a+b, which you can use however you like,
> like so: i=add(2,3) will assign the return value to add.

And return doesn't have to return a value(s).  It can just cause the
program's execution to not proceed further but to go back
to the calling function, like:

def checkAplusB(a, b):
if a + b > 5:
return


>
> I recommend you check out the tutorial on python.org, which explains all
> of this; the documentation does not need updating, at least not in that
> respect.
> On 1/23/2011 11:41 AM, Scott Meup wrote:
>
> > I'm trying tolearn Python.  The documentation tells syntax, and other things
> > about a command.  But for too many commands, it doesn't tell what it does.
> > for instance, in VB the 'return' command tells the program what line to
> > execute after some event (usually an error). In Python it appears to return
> > a value.  Where does it return it to?  I couldn't find anywhere on the
> > Python website to find out or to ask Python to upgrade their documentation.
> > Can somebody please recommend a source.
>
> --
>
> Thanks,
> Ty

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: documentation / reference help

2011-01-23 Thread Chris Rebert
On Sun, Jan 23, 2011 at 11:52 AM, CM  wrote:
> On Jan 23, 2:38 pm, "Littlefield, Tyler"  wrote:
>> The return value simply returns a value to the calling function, which
>> the function can handle, however it wants. so: for example
>> def add(a, b):
>>    return (a+b)
>>
>> That simply returns the value a+b, which you can use however you like,
>> like so: i=add(2,3) will assign the return value to add.
>
> And return doesn't have to return a value(s).

Pedantic nitpick:
Technically it does; you're just not required to always explicitly provide one.
Python uses None if you don't specify anything
(i.e. a bare `return` === `return None`).
By definition, every function returns *some* value.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which non SQL Database ?

2011-01-23 Thread John Nagle

On 1/22/2011 10:15 PM, Deadly Dirk wrote:

On Sat, 04 Dec 2010 16:42:36 -0600, Jorge Biquez wrote:


Hello all.

Newbie question. Sorry.

As part of my process to learn python I am working on two personal
applications. Both will do it fine with a simple structure of data
stored in files. I now there are lot of databases around I can use but I
would like to know yoor advice on what other options you would consider
for the job (it is training so no pressure on performance).


For something like that, I'd suggest just using SQLite.  It comes
with the Python distribution, it's well documented, and reasonably easy
to use.

The "NoSQL" stuff is mostly for people doing really big databases
for large web sites.  The kind of operations where you have multiple
data centers, thousands of rackmount servers, a huge traffic load,
and smart people thinking about the implications of "eventually
consistent".

Google's BigTable and Facebook's Cassandra offer impressive
performance at very large scale.  But they're way overkill for
a desktop app.  Even the midrange systems, like CouchDB, are
far too much machinery for a desktop app.

John Nagle
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 1:42 pm, Adam Skutt  wrote:
> On Jan 23, 2:07 pm, rantingrick  wrote:
>
> > Well then post a traceback.
>
> None of these issues will supply a traceback; in fact, in some of
> these cases, you went out of your way to ensure that would not
> happen.  

psst: thats because they are FEATURES and NOT BUGS you idiot! I am not
trying to create a working file browser so you can steal my code. No.
I am displaying one use case for a very useful widget. I repeat, i am
not going to code up a free file browser for you Adam. Get a life!

> >  However you still miss the point. You will do anything to distract
> > from the point. And what IS that point? Well that Tkinter is
> > lackluster 20 years old rotware
>
> The fact it doesn't provide a control found almost exclusively in file
> browsers and open/save dialogs does not mean that it is "20 years old
> rotware".

A ListCtrl is useful for many, many purposes. Just one of them happens
to be a file browser. Your statement comes as no great surprise to us
because we all know how you severely lack any kind of vision or
abstract reasoning abilities.

> > and you need to resort to these BS tactics to discredit me because 1). You 
> > cannot even create a Tkinter
> > GUI at the basic level,
>
> I certainly can, but there's no point in demonstrating my skill when
> you cannot create a wxWidgets GUI at a basic level.

BS. You're scared, You're under qualified. And it shows. BIGTIME!

>  You made the
> challenge, you intentionally styled it as "rantingrick v. the world",
> so you need to actually bring something challenge worthy to the table
> first.

Where is the world Adam? I am the only one who has summited code.


> That includes picking a challenge that's interesting and not over a
> relatively minor widget in the grand scheme of things.

ListCtrl's are very useful. And i have many more challenges coming.
WxPython outshines all the competition by leaps and bounds. The
ListCtrl is just the beginning.

>  Qt, Swing,
> Gtk, and Win32 common controls[1] don't provide the same exact control
> either, should we view it as deficient?

Yes.

> But regardless of the challenge,

You keep trying to divert attention from the point. Sorry but you're
not going to fool anyone with this foolishness.

> I don't think you're capable of
> posting a worthwhile example, which is why you dismiss all the
> problems found with it instead of actually fixing the code.

Ditto! But at least i have some code to work with. Something to create
a fact based argument from. You have nothing but your own foolishness
to build from.

> > Post CODE Adam. Code! Surely you can handle copy/pasting a traceback i
> > hope!
>
> I certainly can.  I don't have much hope for you writing code that
> provides tracebacks, much less actually useful ones.

I suppose you gauge the quality of code by how many tracebacks are
printed. And it seems even more perverse that you expect code to spit
exceptions! And when code fails to spit exceptions you get angry about
it and claim the programmer is insufficient. Hmm, this would explain
why you have yet to provide us with working (or even semi-working)
code. Adam you are by far the most foolish person i have ever met.
-- 
http://mail.python.org/mailman/listinfo/python-list


A and B but not C in list

2011-01-23 Thread CM
In Python, is there a recommended way to write conditionals of the
form:

"if A and B but not C or D in my list, do something."  ?

I may also have variations on this, like "if A but not B, C, or D".

Do I have to just write out all the if and elifs with all possible
conditions, or is there a handier and more code-maintainable way to
deal with this?

Thanks.




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Littlefield, Tyler

RR,
I have not seen anything useful from you thus far, except:
1) "you disagree with me, troll you must be,"
"2) who cares if my programs have bugs and don't compile cross-platform, 
defective code is code, none the less.
3) And a lot of unfounded arrogance in stating that no one understands 
Tkinter quite like yourself and a select handful of people.


I hardly think that your tone, attitude and arguments are going to help 
you in your battle to prove that WXPython is superior to anything at 
all, if you can't manage to provide cross-platform bug-free code. No, no 
one else has yet provided code in this thread from what I have seen, 
since that's the point you keep making time and time again in numerous 
messages that keep cluttering my inbox, but no one really has to. You 
are making an argument with a lot of anger and faulty code, which is 
supposed to prove that the library, in which you can't write an 
application that is bug free (or as bug free as any program can be) and 
also maintain the cross-platform goal, which is a huge part of Python 
currently, is superior to another that you are screaming and throwing 
tantrums over. So I await your response, though my psychic powers tells 
me the response will be one of silence, "stfu, you're just a troll," or 
"where's the code, I'm not going to produce bug-free code so you can rip 
off -my- top security amazing file browser," since such things don't 
already exist anyway.

On 1/23/2011 1:23 PM, rantingrick wrote:

On Jan 23, 1:42 pm, Adam Skutt  wrote:

On Jan 23, 2:07 pm, rantingrick  wrote:


Well then post a traceback.

None of these issues will supply a traceback; in fact, in some of
these cases, you went out of your way to ensure that would not
happen.

psst: thats because they are FEATURES and NOT BUGS you idiot! I am not
trying to create a working file browser so you can steal my code. No.
I am displaying one use case for a very useful widget. I repeat, i am
not going to code up a free file browser for you Adam. Get a life!


  However you still miss the point. You will do anything to distract
from the point. And what IS that point? Well that Tkinter is
lackluster 20 years old rotware

The fact it doesn't provide a control found almost exclusively in file
browsers and open/save dialogs does not mean that it is "20 years old
rotware".

A ListCtrl is useful for many, many purposes. Just one of them happens
to be a file browser. Your statement comes as no great surprise to us
because we all know how you severely lack any kind of vision or
abstract reasoning abilities.


and you need to resort to these BS tactics to discredit me because 1). You 
cannot even create a Tkinter
GUI at the basic level,

I certainly can, but there's no point in demonstrating my skill when
you cannot create a wxWidgets GUI at a basic level.

BS. You're scared, You're under qualified. And it shows. BIGTIME!


  You made the
challenge, you intentionally styled it as "rantingrick v. the world",
so you need to actually bring something challenge worthy to the table
first.

Where is the world Adam? I am the only one who has summited code.



That includes picking a challenge that's interesting and not over a
relatively minor widget in the grand scheme of things.

ListCtrl's are very useful. And i have many more challenges coming.
WxPython outshines all the competition by leaps and bounds. The
ListCtrl is just the beginning.


  Qt, Swing,
Gtk, and Win32 common controls[1] don't provide the same exact control
either, should we view it as deficient?

Yes.


But regardless of the challenge,

You keep trying to divert attention from the point. Sorry but you're
not going to fool anyone with this foolishness.


I don't think you're capable of
posting a worthwhile example, which is why you dismiss all the
problems found with it instead of actually fixing the code.

Ditto! But at least i have some code to work with. Something to create
a fact based argument from. You have nothing but your own foolishness
to build from.


Post CODE Adam. Code! Surely you can handle copy/pasting a traceback i
hope!

I certainly can.  I don't have much hope for you writing code that
provides tracebacks, much less actually useful ones.

I suppose you gauge the quality of code by how many tracebacks are
printed. And it seems even more perverse that you expect code to spit
exceptions! And when code fails to spit exceptions you get angry about
it and claim the programmer is insufficient. Hmm, this would explain
why you have yet to provide us with working (or even semi-working)
code. Adam you are by far the most foolish person i have ever met.



--

Thanks,
Ty

--
http://mail.python.org/mailman/listinfo/python-list


Re: A and B but not C in list

2011-01-23 Thread Corey Richardson

On 01/23/2011 04:05 PM, CM wrote:

In Python, is there a recommended way to write conditionals of the
form:

"if A and B but not C or D in my list, do something."  ?

I may also have variations on this, like "if A but not B, C, or D".

Do I have to just write out all the if and elifs with all possible
conditions, or is there a handier and more code-maintainable way to
deal with this?

Thanks.






if (A in list and B in list) and (C not in list or D not in list):
pass

I'm sure the gurus on this list can come up with something better.
--
http://mail.python.org/mailman/listinfo/python-list


Re: A and B but not C in list

2011-01-23 Thread Chris Rebert
On Sun, Jan 23, 2011 at 1:05 PM, CM  wrote:
> In Python, is there a recommended way to write conditionals of the
> form:
>
> "if A and B but not C or D in my list, do something."  ?
>
> I may also have variations on this, like "if A but not B, C, or D".
>
> Do I have to just write out all the if and elifs with all possible
> conditions, or is there a handier and more code-maintainable way to
> deal with this?

Assuming your conditions all involve membership testing...
Use the built-in any() and all() functions. For your first example:

wanteds = [A, B]
unwanteds = [C, D]
if all(wanted in your_list for wanted in wanteds) and \
not any(unwanted in your_list for unwanted in unwanteds):
do_whatever()

You could pull this out into a separate function if you wish.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: pyftpdlib 0.6.0 released

2011-01-23 Thread Giampaolo Rodolà
Hi,
I'm pleased to announce release 0.6.0 of Python FTP Server library (pyftpdlib).
http://code.google.com/p/pyftpdlib/

=== About ===

Python FTP server library provides an high-level portable interface to
easily write asynchronous FTP/S servers with Python. Based on asyncore
framework pyftpdlib is currently the most complete RFC-959 FTP server
implementation available for Python programming language.


=== Major changes ===

This new version, aside from fixing some bugs, includes some important
new features:

 * (finally) full FTPS (FTP over SSL/TS) support
 * configurable command line options
 * a standardized and improved logging system for commands and transfers
 * possibility to serve both IPv4 and IPv6 by using a single socket
 * enhanced Unix and Windows authorizers, moved from demo directory
and included in main library with a set of new options such as the
possibility to specify which users should be granted for access.
 * enabled TCP_NODELAY socket option for the FTP command channels
resulting in pyftpdlib being twice faster.
 * a new UnixFilesystem class which permits the client to escape its
home directory and navigate the real filesystem.


A complete list of changes including enhancements, bug fixes and
instructions for using the new functionalities is available here:
http://code.google.com/p/pyftpdlib/wiki/ReleaseNotes06

If you think pyftpdlib is worth a donation you can do so by going here:
http://code.google.com/p/pyftpdlib/wiki/Donate


=== More links ===

* Source tarball: http://pyftpdlib.googlecode.com/files/pyftpdlib-0.6.0.tar.gz
* Online docs: http://code.google.com/p/pyftpdlib/wiki/Tutorial
* FAQs: http://code.google.com/p/pyftpdlib/wiki/FAQ
* RFCs compliance paper: http://code.google.com/p/pyftpdlib/wiki/RFCsCompliance
* Issue tracker: http://code.google.com/p/pyftpdlib/issues/list


Thanks,


-- Giampaolo Rodola' < g.rodola [at] gmail [dot] com >
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A and B but not C in list

2011-01-23 Thread Christian Heimes
Am 23.01.2011 22:05, schrieb CM:
> In Python, is there a recommended way to write conditionals of the
> form:
> 
> "if A and B but not C or D in my list, do something."  ?
> 
> I may also have variations on this, like "if A but not B, C, or D".
> 
> Do I have to just write out all the if and elifs with all possible
> conditions, or is there a handier and more code-maintainable way to
> deal with this?

It's easier and faster if you convert the lists to sets first:

your_set = set(your_list)

if your_set.issuperset(set([A, B])) and your_set.isdisjoint(set([C, D])):
...

Christian

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need GUI pop-up to edit a (unicode ?) string

2011-01-23 Thread Rikishi42
On 2011-01-22, geremy condra  wrote:
> If windows doesn't matter to you, just use Zenity. Here's a python
> function wrapping zenity that does what you want:
>
> import commands
>
> def confirm_or_edit(s):
> zenity = 'zenity'
> mode = '--entry'
> text = "--text='Please confirm or edit the following string:'"
> title = "--title='confirm or edit'"
> entry = "--entry-text='%s'" % s
> cmd = ' '.join([zenity, mode, text, title, entry])
> status, output = commands.getstatusoutput(cmd)
> if status: raise Exception("Couldn't run zenity")
> return output
>
> There's also a full-blown API for zenity, but this should do what you want.

Very, very nice. Thanks !

I'm amazed at how many GUI's are available.


No wonder I couldn't find "the" interface, there are too many.   :-)




-- 
When in doubt, use brute force.
-- Ken Thompson
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Adam Skutt
On Jan 23, 3:23 pm, rantingrick  wrote:
> psst: thats because they are FEATURES and NOT BUGS you idiot!

Your application not displaying a directory listing, due to one of
these "features", is desirable behavior?  I think not.  Your
application hanging, due to one of these "features" is desirable
behavior? I think not, nor do the wxWidgets, Qt, Swing, Cocoa, Gtk,
Win32, et al. toolkit developers.

> I am not trying to create a working file browser so you can steal my code.

I have ethics, morals, and standards, all of which forbid me from
stealing anything you write.

> I am displaying one use case for a very useful widget.

So useful that you've only found one toolkit that provides it OOB!

> A ListCtrl is useful for many, many purposes. Just one of them happens
> to be a file browser.

The specific functionality the wxWidgets ListCtrl has over its
alternatives in other toolkits is only really seen in file browsers.
Your challenge explicitly relies on making use of that functionality
and in no way, shape, or form illustrates the general utility of a
wxListCtrl.

When you amend the challenge, you can make the claim it's not about
wxListCtrl's unique functionality.

> >  Qt, Swing,
> > Gtk, and Win32 common controls[1] don't provide the same exact control
> > either, should we view it as deficient?

> Yes.

Funny, given that the original purpose of wxWidgets was to provide a
cross-platform MFC wrapper, I think you're in the minority of thought
among those developers, to say nothing of developers in general.

> I suppose you gauge the quality of code by how many tracebacks are
> printed. And it seems even more perverse that you expect code to spit
> exceptions!

You're the one who asked for them originally, not I.  I merely posited
that since you provided code that prints no tracebacks and expected
them (i.e., what you expect your code to do and what it does are two
different things), that it is highly unlikely you're capable of
providing me code that actually prints tracebacks, much less
tracebacks that assist you in debugging.

Put plainly, you have no clue whatsoever what your code actually does
or how it accomplishes it, which is exactly what we'd expect.

Adam
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Nicholas Devenish

Hi Adam,

I'm still learning my way around wxPython and gui programming, been 
mostly linux and CLI since Visual Basic 5, and only recently started 
learning it.


On 23/01/2011 18:09, Adam Skutt wrote:

1. There's a bug related to loading of your resources.
2. There's a bug related to when file I/O is performed.
3/4. There's at least two bugs related to handling of a specific mouse
event.
5. There's a bug related to reporting errors to the user.

All of these bugs, except one[1], show a grave misunderstanding about
how GUI toolkits operate and/or how the underlying operating systems
behave.

>

[1] Which is only because wxWidgets has a bug in this regard.  That
being said, a workaround exists and trivial to find online.


I'd be curious as to what these bugs are, as a learning exercise, if you 
don't mind. I don't mind a direct mail if you wish not to subject 
yourself to any more abuse on the list, as would almost certainly come. 
I'd especially like to be pointed at the error you refer to in [1].



On to the topic of the program direct, the 'List view' button doesn't 
seem to work on my platform, showing a blank folder icon and nothing 
else, but I don't know if that is related to any of these bugs.


I actually looked around when I wanted to start learning gui 
programming, and chose wxPython because it seemed to use 'native' 
controls on all of the platforms. This file viewer just looks awful (is 
it supposed to flicker so much when I try to change the column size?) so 
I'm not exactly sure what it is supposed to prove.


Nick
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 3:11 pm, "Littlefield, Tyler"  wrote:

> if you can't manage to provide cross-platform bug-free code.

No one has posted even one traceback Tyler (including yourself!). And
until they do i will assume that my code is bug free. I know it to be
bug free on windows. If and when someone *actually* provides proof
(supported by a traceback) then i will take them seriously.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread David Boddie
On Sunday 23 January 2011 17:57, rantingrick wrote:

> On Jan 22, 9:39 pm, Terry Reedy  wrote:
>> On 1/22/2011 7:07 PM, rantingrick wrote:
>>
>> Near the beginning of this thread, I gently challenged you to produce a
>> concrete, practical proposal for an stdlib addition that could be
>> critiqued and improved. When you asked for problems with
>> wxwidgets/wxpython, I gave some. Still waiting.
> 
> You may have done this however i do not remember. With all the
> trolling that was going on (not you) i may have missed it.

^^^ +1 QOTW

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 05:08 PM, rantingrick wrote:

On Jan 23, 3:11 pm, "Littlefield, Tyler"  wrote:


if you can't manage to provide cross-platform bug-free code.


No one has posted even one traceback Tyler (including yourself!). And
until they do i will assume that my code is bug free. I know it to be
bug free on windows. If and when someone *actually* provides proof
(supported by a traceback) then i will take them seriously.





There are more types of bugs than syntax errors, which are one of the 
only types of bug that raise exceptions in Python. Try looking at [1] or 
[2].


Here is the output on my system (Linux Mint 64bit):

/home/corey/Downloads/Wx_Tk_Challenge/Bitmaps
Loading Images:
 -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/file.bmp file.bmp
 -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/folder.bmp folder.bmp
 -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/link.bmp link.bmp
['folder', 'link', 'file']
Segmentation fault



[1] http://en.wikipedia.org/wiki/Software_bug#Common_types_of_computer_bugs
[2] http://msdn.microsoft.com/en-us/library/s9ek7a19%28v=vs.80%29.aspx
--
http://mail.python.org/mailman/listinfo/python-list


How to execute foreing code from Python

2011-01-23 Thread hidura
Hello i want to code from different languages using a Python script i know  
i can use os.system, but i don't know how to receive data or send arguments  
using that method if theres any another way to make it or there's a way to  
send arguments and receive data using os.system?


Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which non SQL Database ?

2011-01-23 Thread Verde Denim
On Sun, Jan 23, 2011 at 3:19 PM, John Nagle  wrote:

> On 1/22/2011 10:15 PM, Deadly Dirk wrote:
>
>> On Sat, 04 Dec 2010 16:42:36 -0600, Jorge Biquez wrote:
>>
>>  Hello all.
>>>
>>> Newbie question. Sorry.
>>>
>>> As part of my process to learn python I am working on two personal
>>> applications. Both will do it fine with a simple structure of data
>>> stored in files. I now there are lot of databases around I can use but I
>>> would like to know yoor advice on what other options you would consider
>>> for the job (it is training so no pressure on performance).
>>>
>>
>For something like that, I'd suggest just using SQLite.  It comes
> with the Python distribution, it's well documented, and reasonably easy
> to use.
>
>The "NoSQL" stuff is mostly for people doing really big databases
> for large web sites.  The kind of operations where you have multiple
> data centers, thousands of rackmount servers, a huge traffic load,
> and smart people thinking about the implications of "eventually
> consistent".
>
>Google's BigTable and Facebook's Cassandra offer impressive
> performance at very large scale.  But they're way overkill for
> a desktop app.  Even the midrange systems, like CouchDB, are
> far too much machinery for a desktop app.
>
>John Nagle
>

This may sound a bit 'old school', but if it's a non-sql solution you're
after, what about c-isam ?
Data is indexed and stored in flat files. For a personal app that maintains
a small footprint, it's relative performance is acceptable. If the number of
entities and attributes rises above a handful, however, I would recommend
investing more thought in whether this is a permanent solution.

Regards

Jack

> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Steven D'Aprano
On Sun, 23 Jan 2011 12:23:13 -0800, rantingrick wrote:

> I am not
> trying to create a working file browser so you can steal my code.

Dammit! There goes my brilliant idea for getting rich.

Step 1: Start company.
Step 2: Steal working file browser from Internet.
Step 4: Profit!



I think rantingrick's comment inadvertently shows in a nutshell 
everything wrong with this thread and why there is so little interest in 
his proposal. If RR is right about the GUI toolkit making or breaking the 
entire Python community, there should be hundreds of people with an 
opinion, not just a handful.

(1) rantingrick is willing to spend *hours* brow-beating people, 
insulting them, and cajoling them into doing things *his* way, supposedly 
because of his deep concern for the Python community, but isn't willing 
to donate a lousy *file browser* to the community.

(2) GUI programming is TOO DAMN HARD, and until that fact is addressed, 
it's difficult for the majority of people to care whether the toolkit 
used (or, more likely, not used at all) is Tkinter, or wxPython, or 
something else.

For something as common as displaying a file browser, it should be as 
simple as this:

import gui_toolkit  # whichever
path = gui_toolkit.select_file()

Something like zenity:

[steve@sylar ~]$ zenity --file-selection
/home/steve/python/findsingle.py


Of course there are times when you need to do more complicated things, 
and a decent toolkit should allow you to do so. But simple things should 
be simple, and as far as I can see, there are no GUI toolkits that make 
*anything* simple.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A and B but not C in list

2011-01-23 Thread Steven D'Aprano
On Sun, 23 Jan 2011 22:34:33 +0100, Christian Heimes wrote:

> It's easier and faster if you convert the lists to sets first:
> 
> your_set = set(your_list)
> 
> if your_set.issuperset(set([A, B])) and your_set.isdisjoint(set([C,
> D])):
> ...

"Easier" is a close thing. I find this easier to remember and write than 
set processing, even if it is a couple of characters longer:

if all(x in your_list for x in (A, B)) and not any(x in your_list for x 
in (C, D)):
...

And as for "faster", surely that will depend on the number of elements in 
your_list? The conversion from list to set doesn't happen for free, and 
it's likely that for small enough lists, that time may exceed any time 
savings you would otherwise gain.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Code Challenge] WxPython versus Tkinter.

2011-01-23 Thread Kevin Walzer
I found this code in the Demo/tkinter/ttk directory of the Python 2.7.1 
source distribution. I'm NOT the author (credit should probably go to 
Guilherme Polo, developer of the Tkinter wrapper for the ttk themed 
widgets that is now in the stdlib). But, using a tree/listview widget 
that is part of the Tk/Tkinter core (NOT an extension),  it presents a 
decent, simple file browser:


"""A directory browser using Ttk Treeview.

Based on the demo found in Tk 8.5 library/demos/browse
"""
import os
import glob
import Tkinter
import ttk

def populate_tree(tree, node):
if tree.set(node, "type") != 'directory':
return

path = tree.set(node, "fullpath")
tree.delete(*tree.get_children(node))

parent = tree.parent(node)
special_dirs = [] if parent else glob.glob('.') + glob.glob('..')

for p in special_dirs + os.listdir(path):
ptype = None
p = os.path.join(path, p).replace('\\', '/')
if os.path.isdir(p): ptype = "directory"
elif os.path.isfile(p): ptype = "file"

fname = os.path.split(p)[1]
id = tree.insert(node, "end", text=fname, values=[p, ptype])

if ptype == 'directory':
if fname not in ('.', '..'):
tree.insert(id, 0, text="dummy")
tree.item(id, text=fname)
elif ptype == 'file':
size = os.stat(p).st_size
tree.set(id, "size", "%d bytes" % size)


def populate_roots(tree):
dir = os.path.abspath('.').replace('\\', '/')
node = tree.insert('', 'end', text=dir, values=[dir, "directory"])
populate_tree(tree, node)

def update_tree(event):
tree = event.widget
populate_tree(tree, tree.focus())

def change_dir(event):
tree = event.widget
node = tree.focus()
if tree.parent(node):
path = os.path.abspath(tree.set(node, "fullpath"))
if os.path.isdir(path):
os.chdir(path)
tree.delete(tree.get_children(''))
populate_roots(tree)

def autoscroll(sbar, first, last):
"""Hide and show scrollbar as needed."""
first, last = float(first), float(last)
if first <= 0 and last >= 1:
sbar.grid_remove()
else:
sbar.grid()
sbar.set(first, last)

root = Tkinter.Tk()

vsb = ttk.Scrollbar(orient="vertical")
hsb = ttk.Scrollbar(orient="horizontal")

tree = ttk.Treeview(columns=("fullpath", "type", "size"),
displaycolumns="size", yscrollcommand=lambda f, l: autoscroll(vsb, 
f, l),

xscrollcommand=lambda f, l:autoscroll(hsb, f, l))

vsb['command'] = tree.yview
hsb['command'] = tree.xview

tree.heading("#0", text="Directory Structure", anchor='w')
tree.heading("size", text="File Size", anchor='w')
tree.column("size", stretch=0, width=100)

populate_roots(tree)
tree.bind('<>', update_tree)
tree.bind('', change_dir)

# Arrange the tree and its scrollbars in the toplevel
tree.grid(column=0, row=0, sticky='nswe')
vsb.grid(column=1, row=0, sticky='ns')
hsb.grid(column=0, row=1, sticky='ew')
root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(0, weight=1)

root.mainloop()




--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
>> Segmentation fault
>>
>> [Actually this is the first time in my 10 years of python that Ive
>> seen a pure python module segfault :-) ]
> 
> Congratulations genius! However if you are really smart you would have
> read the note in the source that says "tested on windows only!".
> Segfault. Thanks for the laugh!

I get the same:

/tmp/Wx_Tk_Challenge/Bitmaps
Loading Images:
 -- /tmp/Wx_Tk_Challenge/Bitmaps/file.bmp file.bmp
 -- /tmp/Wx_Tk_Challenge/Bitmaps/link.bmp link.bmp
 -- /tmp/Wx_Tk_Challenge/Bitmaps/folder.bmp folder.bmp
['folder', 'link', 'file']
Speicherzugriffsfehler

Since you are asking for a traceback, here is one:

Program received signal SIGSEGV, Segmentation fault.
0x7554c8cd in wxListMainWindow::InsertItem(wxListItem&) () from
/usr/lib/libwx_gtk2u_core-2.6.so.0
(gdb) bt
#0  0x7554c8cd in wxListMainWindow::InsertItem(wxListItem&) ()
from /usr/lib/libwx_gtk2u_core-2.6.so.0
#1  0x7554c940 in wxGenericListCtrl::InsertItem(wxListItem&) ()
from /usr/lib/libwx_gtk2u_core-2.6.so.0
#2  0x7554f012 in wxGenericListCtrl::InsertItem(long, wxString
const&, int) () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#3  0x7fffee58c460 in ?? () from
/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode/wx/_controls_.so
#4  0x004a794b in PyEval_EvalFrameEx ()
#5  0x004a95c1 in PyEval_EvalCodeEx ()
#6  0x004a7752 in PyEval_EvalFrameEx ()
#7  0x004a84a0 in PyEval_EvalFrameEx ()
#8  0x004a95c1 in PyEval_EvalCodeEx ()
#9  0x00538b0d in ?? ()
#10 0x0041ef47 in PyObject_Call ()
#11 0x00427c1f in ?? ()
#12 0x0041ef47 in PyObject_Call ()
#13 0x004778ff in ?? ()
#14 0x0046f16f in ?? ()
#15 0x0041ef47 in PyObject_Call ()
#16 0x004a72b8 in PyEval_EvalFrameEx ()
#17 0x004a95c1 in PyEval_EvalCodeEx ()
#18 0x004a9692 in PyEval_EvalCode ()
#19 0x004c98be in PyRun_FileExFlags ()
#20 0x004c9ad4 in PyRun_SimpleFileExFlags ()
#21 0x0041a6bd in Py_Main ()
#22 0x769eac4d in __libc_start_main () from /lib/libc.so.6
#23 0x004198d9 in _start ()

If you had expected a Python traceback, sorry Rick: it didn't produce
one, since it crashed.

So Rick you managed to crash wxPython, in just 248 lines of code. This
doesn't give a very good impression of wxPython - "regular" Python
libraries shouldn't crash the interpreter.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute foreing code from Python

2011-01-23 Thread Chris Rebert
On Sun, Jan 23, 2011 at 2:21 PM,   wrote:
> Hello i want to code from different languages using a Python script i know i
> can use os.system, but i don't know how to receive data or send arguments
> using that method if theres any another way to make it or there's a way to
> send arguments and receive data using os.system?

Which other languages specifically?
Also, the `subprocess` module
(http://docs.python.org/library/subprocess.html ) is preferred over
os.system().

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis

> For something as common as displaying a file browser, it should be as 
> simple as this:
> 
> import gui_toolkit  # whichever
> path = gui_toolkit.select_file()
> 
> Something like zenity:
> 
> [steve@sylar ~]$ zenity --file-selection
> /home/steve/python/findsingle.py

And indeed, it is that simple:

python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 22, 6:07 pm, rantingrick  wrote:

> I await any challengers...


WxPython Challenge 1 code updated...

 * Fixed tab traveral
 * Removed hand-holding code
 * Removed some cruft

  https://sites.google.com/site/thefutureofpython/home/code-challenges

Good luck!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
> WxPython Challenge 1 code updated...
> 
>  * Fixed tab traveral
>  * Removed hand-holding code
>  * Removed some cruft
> 
>   https://sites.google.com/site/thefutureofpython/home/code-challenges
> 
> Good luck!

Still crashes the interpreter.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A and B but not C in list

2011-01-23 Thread Terry Reedy

On 1/23/2011 4:05 PM, CM wrote:

In Python, is there a recommended way to write conditionals of the
form:

"if A and B but not C or D in my list, do something."  ?

I may also have variations on this, like "if A but not B, C, or D".

Do I have to just write out all the if and elifs with all possible
conditions, or is there a handier and more code-maintainable way to
deal with this?


The straightforward code

if a in L and b in L and c not in L and d not in L

scans the list 4 times. One scan be be done generically as follows:

def req_pro(iterable, required = set(), prohibited = set()):
for item in iterable:
if item in prohibited:
return False
elif item in required:
   required.remove(item)
else:
return not required # should now be empty

if req_pro(my_list, {A,B}, {C,D}): ...
# untested, of course..

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 07:07 PM, rantingrick wrote:

On Jan 22, 6:07 pm, rantingrick  wrote:


I await any challengers...



WxPython Challenge 1 code updated...

  * Fixed tab traveral
  * Removed hand-holding code
  * Removed some cruft

   https://sites.google.com/site/thefutureofpython/home/code-challenges

Good luck!


Still doesn't fix the problem of the code not working on Linux boxes. 
Maybe wxPython isn't the best option, it doesn't appear very cross-platform.

Still getting:

Loading Images:
 -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/file.bmp, file.bmp
 -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/folder.bmp, folder.bmp
 -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/link.bmp, link.bmp
imageMap.keys -> ['folder', 'link', 'file']
Segmentation fault

--
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute foreing code from Python

2011-01-23 Thread Dave Angel

On 01/-10/-28163 02:59 PM, hid...@gmail.com wrote:

Hello i want to code from different languages using a Python script i
know i can use os.system, but i don't know how to receive data or send
arguments using that method if theres any another way to make it or
there's a way to send arguments and receive data using os.system?

Thanks in advance.



That sentence runs on, and makes no sense to me.  But I can guess that 
you would like to be able to write code in other languages, and call it 
from within a Python script.


If you're on Windows, and the other language is a compiled one like C, 
compile it into a DLL, and call that DLL from Python.  Ctypes is the 
first module to study.


If you're on Linux, and the code in the other language was written by 
someone else, and is already compiled into an executable you cannot 
change, you probably should invoke it using the subprocess module.  You 
can supply information to the executable via the commandline arguments 
and also via stdin, and you can receive results via the exit code, and 
via stdout.


Any more details and options would need lots more information about your 
environment and your constraints.


DaveA
--
http://mail.python.org/mailman/listinfo/python-list


Re: documentation / reference help

2011-01-23 Thread Terry Reedy

On 1/23/2011 1:41 PM, Scott Meup wrote:

I'm trying tolearn Python.  The documentation tells syntax, and other things
about a command.  But for too many commands, it doesn't tell what it does.
for instance, in VB the 'return' command tells the program what line to
execute after some event (usually an error). In Python it appears to return
a value.  Where does it return it to?


The return object replaces the function call in the expression that 
contains the function call.


Given: x = 1; j = [2,3]; def f(): return 4
the expression: x + y[1] + f()
becomes: 1 + 3 + 4

In other words, names are looked up in the appropriate namespace and 
replaced with the object they are associated with in that namespace. 
Names followed by square brackets are replaced by the result of an 
indexing operation. Names followed by parentheses are called and 
replaced by the object returned.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 5:23 pm, Kevin Walzer  wrote:
> I found this code in the Demo/tkinter/ttk directory of the Python 2.7.1
> source distribution. I'm NOT the author (credit should probably go to
> Guilherme Polo, developer of the Tkinter wrapper for the ttk themed
> widgets that is now in the stdlib). But, using a tree/listview widget
> that is part of the Tk/Tkinter core (NOT an extension),  it presents a
> decent, simple file browser:
>
> """A directory browser using Ttk Treeview.

The only way i can respond to this is to quite the requirements for my
challenge...

---
 Challenge 1: (Simple Directory Viewer)
---
Create a simple Directory Viewer GUI. You CANNOT use a treectrl!


Any questions?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Kevin Walzer

On 1/23/11 8:12 PM, rantingrick wrote:


The only way i can respond to this is to quite the requirements for my
challenge...

---
  Challenge 1: (Simple Directory Viewer)
---
Create a simple Directory Viewer GUI. You CANNOT use a treectrl!


Any questions?


Why not?

I'd understand if this code made use of some Tk extension, as that's not 
quite an apples-to-apples comparison. But the treectrl is part of the 
core Tkinter widget set. There's no reason to exclude it unless you are 
deliberately trying to handicap Tk in your comparison.


--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Steven D'Aprano
On Mon, 24 Jan 2011 00:44:57 +0100, Martin v. Loewis wrote:

>> For something as common as displaying a file browser, it should be as
>> simple as this:
>> 
>> import gui_toolkit  # whichever
>> path = gui_toolkit.select_file()
>> 
>> Something like zenity:
>> 
>> [steve@sylar ~]$ zenity --file-selection
>> /home/steve/python/findsingle.py
> 
> And indeed, it is that simple:
> 
> python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"

Brilliant! Pity that it is so ugly under Linux :(



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 5:27 pm, "Martin v. Loewis"  wrote:

> Since you are asking for a traceback, here is one:

[...snip: barf...]

> If you had expected a Python traceback, sorry Rick: it didn't produce
> one, since it crashed.

Well i did "expect" that you would at least include some info as to
your OS and version. That would be helpful also. Obviously the
wx.ImageList is barfing. Do you have the Bitmap folder containing the
three images. Did you try to comment out the "_createImages()" line.
Simple debug skills we are talking about here Martin, simple. But yet
again this is only tested on Windows. I clearly noted that in the
source.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 5:44 pm, "Martin v. Loewis"  wrote:
> > For something as common as displaying a file browser, it should be as
> > simple as this:
>
> > import gui_toolkit  # whichever
> > path = gui_toolkit.select_file()
>
> > Something like zenity:
>
> > [steve@sylar ~]$ zenity --file-selection
> > /home/steve/python/findsingle.py
>
> And indeed, it is that simple:
>
> python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"


Martin the tkFileDialog.ask* uses the platform specific Open, Save
dialogs which DO contain a ListCtrl. Obviously this ListCtrl is not
available to Tkinter uses. You just exposed your weak knowledge of
Tkinter and sadly you are very high on the community totem pole. Very
sad :(

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 6:31 pm, "Martin v. Loewis"  wrote:
> > WxPython Challenge 1 code updated...
>
> >  * Fixed tab traveral
> >  * Removed hand-holding code
> >  * Removed some cruft
>
> >  https://sites.google.com/site/thefutureofpython/home/code-challenges
>
> > Good luck!
>
> Still crashes the interpreter.


 What OS are you using? You failed to answer this last question
lastime.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 6:30 pm, Corey Richardson  wrote:
> On 01/23/2011 07:07 PM, rantingrick wrote:
>
> > On Jan 22, 6:07 pm, rantingrick  wrote:
>
> >> I await any challengers...
>
> > WxPython Challenge 1 code updated...
>
> >   * Fixed tab traveral
> >   * Removed hand-holding code
> >   * Removed some cruft
>
> >    https://sites.google.com/site/thefutureofpython/home/code-challenges
>
> > Good luck!
>
> Still doesn't fix the problem of the code not working on Linux boxes.
> Maybe wxPython isn't the best option, it doesn't appear very cross-platform.
> Still getting:
>
> Loading Images:
>   -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/file.bmp, file.bmp
>   -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/folder.bmp, folder.bmp
>   -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/link.bmp, link.bmp
> imageMap.keys -> ['folder', 'link', 'file']
> Segmentation fault

Have you tried any debugging? Maybe Linux has some specific needs and
NOT wxPython. Stop jumping to conclusions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 7:16 pm, Kevin Walzer  wrote:
> On 1/23/11 8:12 PM, rantingrick wrote:
>
> > The only way i can respond to this is to quite the requirements for my
> > challenge...
>
> > ---
> >   Challenge 1: (Simple Directory Viewer)
> > ---
> > Create a simple Directory Viewer GUI. You CANNOT use a treectrl!
>
> > Any questions?
>
> Why not?
>
> I'd understand if this code made use of some Tk extension, as that's not
> quite an apples-to-apples comparison. But the treectrl is part of the
> core Tkinter widget set.

Well wxPython ha a treectrl too. And if we were comparing apples to
apples then we would compare the wx.TreeCtrl to the Tk::TreeCtrl.
However there are many things that a ListCtrl can do that a treectrl
can't. The biggest difference COLUMNS

> There's no reason to exclude it (Tk::TreeCtrl) unless you are
> deliberately trying to handicap Tk in your comparison.

I am not handicapping TclTk. They already did that themselves by
refusing to keep up with  21st century GUI libraries. Sure, you can
say Tkinter is a knife and wxPython is an AK47 but who's to blame when
you bring a knife to gun fight Kevin? Switch to wx and enjoy the
bloodbath.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 7:18 pm, Steven D'Aprano  wrote:
> On Mon, 24 Jan 2011 00:44:57 +0100, Martin v. Loewis wrote:
> >> For something as common as displaying a file browser, it should be as
> >> simple as this:
>
> >> import gui_toolkit  # whichever
> >> path = gui_toolkit.select_file()
>
> >> Something like zenity:
>
> >> [steve@sylar ~]$ zenity --file-selection
> >> /home/steve/python/findsingle.py
>
> > And indeed, it is that simple:
>
> > python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"
>
> Brilliant!


No, that was even weaker than Guido's tag argument. At LEAST when
Guido parrots off minor issues he uses some fact based argument. This
is just pathetic! Only the lemmings would believe such nonsense.

> Pity that it is so ugly under Linux :(

And who's fault is that i wonder?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 08:25 PM, rantingrick wrote:

On Jan 23, 5:44 pm, "Martin v. Loewis"  wrote:

For something as common as displaying a file browser, it should be as
simple as this:



import gui_toolkit  # whichever
path = gui_toolkit.select_file()



Something like zenity:



[steve@sylar ~]$ zenity --file-selection
/home/steve/python/findsingle.py


And indeed, it is that simple:

python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"



Martin the tkFileDialog.ask* uses the platform specific Open, Save
dialogs which DO contain a ListCtrl. Obviously this ListCtrl is not
available to Tkinter uses. You just exposed your weak knowledge of
Tkinter and sadly you are very high on the community totem pole. Very
sad :(



Actually, the people on the top of the totem pole were of less social 
status. 
http://podcasts.howstuffworks.com/hsw/podcasts/sysk/2009-11-17-sysk-totem-poles.mp3?_kip_ipx=1723793795-1295833113


(Finally, useful knowledge from listening to podcasts in my off-time!)

You have also ignored that I gave the same information as him (minus the 
traceback), saying that I am on Linux Mint 64bit.


Why can't we use a TreeCtrl? If we can't use all our widgets, why can 
you use all yours?


~Corey
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 7:40 pm, Corey Richardson  wrote:

> Why can't we use a TreeCtrl? If we can't use all our widgets, why can
> you use all yours?
>
> ~Corey

Columns Corey, the key word here is "columns". One more
time...COOLUUUMMMNNN. Is this starting to sink in yet
Corey?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute foreing code from Python

2011-01-23 Thread Dan Stromberg
On Sun, Jan 23, 2011 at 4:24 PM, Dave Angel  wrote:
> On 01/-10/-28163 02:59 PM, hid...@gmail.com wrote:
>>
>> Hello i want to code from different languages using a Python script i
>> know i can use os.system, but i don't know how to receive data or send
>> arguments using that method if theres any another way to make it or
>> there's a way to send arguments and receive data using os.system?
>>
>> Thanks in advance.
>>
>
> That sentence runs on, and makes no sense to me.  But I can guess that you
> would like to be able to write code in other languages, and call it from
> within a Python script.

Well, clearly it made some sense, or you wouldn't be responding.

> If you're on Windows, and the other language is a compiled one like C,
> compile it into a DLL, and call that DLL from Python.  Ctypes is the first
> module to study.

The DLL is but a weak mimicry of what *ix had for a long time before.
On most *ix's, the .so is the analog to the windows DLL, though only
AIX appears to suffer from the same kind of "DLL hell" that windows
suffers from (which makes some historical if not technical sense,
given that windows is related to OS/2, which like AIX is also from
IBM).  Using a .so, you can still use ctypes.  You also have the
option of using Cython, which is perhaps a bit better supported on
*ix, but will likely now work on windows too.

> If you're on Linux, and the code in the other language was written by
> someone else, and is already compiled into an executable you cannot change,

This is rare on Linux - almost everything is changeable on Linux,
because it is almost entirely opensource - sometimes entirely so,
depending on distribution choice and what 3rd party apps you install
after the OS install.

> you probably should invoke it using the subprocess module.

This is an option on almost any OS, and in fact is probably a pretty
good one on almost any OS, even if you do have source.  Sadly, few
windows programs are written to take advantage of this, perhaps
because of the historical (dos/windows) command.com's fake pipes.

You can communicate with a subprocess using pipes, or command line
arguments, or files, or sockets, or shared memory.  There are probably
other options that aren't coming to mind just now.  But usually, using
pipes gives the loosest (best) coupling between processes.

Microsoft appears to have recognized this to some extent by releasing
powershell - though it uses object pipes rather than byte stream
pipes.  Object pipes appear to require less serialization, but also
appear to be less loosely coupled.  For remote pipes, powershell
serializes to XML, while *ix pipes serialize exactly the same way
remote local or remote.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 08:50 PM, rantingrick wrote:

On Jan 23, 7:40 pm, Corey Richardson  wrote:


Why can't we use a TreeCtrl? If we can't use all our widgets, why can
you use all yours?

~Corey


Columns Corey, the key word here is "columns". One more
time...COOLUUUMMMNNN. Is this starting to sink in yet
Corey?


I sent that email before you sent your email explaining why (responded 
to Kevin), sorry that I can't see the future.

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 08:28 PM, rantingrick wrote:

On Jan 23, 6:30 pm, Corey Richardson  wrote:

On 01/23/2011 07:07 PM, rantingrick wrote:


On Jan 22, 6:07 pm, rantingrickwrote:



I await any challengers...



WxPython Challenge 1 code updated...



   * Fixed tab traveral
   * Removed hand-holding code
   * Removed some cruft



https://sites.google.com/site/thefutureofpython/home/code-challenges



Good luck!


Still doesn't fix the problem of the code not working on Linux boxes.
Maybe wxPython isn't the best option, it doesn't appear very cross-platform.
Still getting:

Loading Images:
   -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/file.bmp, file.bmp
   -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/folder.bmp, folder.bmp
   -- /home/corey/Downloads/Wx_Tk_Challenge/Bitmaps/link.bmp, link.bmp
imageMap.keys ->  ['folder', 'link', 'file']
Segmentation fault


Have you tried any debugging? Maybe Linux has some specific needs and
NOT wxPython. Stop jumping to conclusions.



Python (and supposedly wxPython) are cross-platform. Code that runs on 
one should run on the other unmodified. This is obviously not the case.


Line 151 fails (determined from a simple binary search using print 
statements):


index = self.InsertImageStringItem(sys.maxint, name, imageIdx)

Maybe wxPython (really wxwidgets, python doesn't throw segfaults...that 
I've ever seen) isn't suited for the stdlib, unless this is a just a 
really silly bug somewhere in your programming (which I doubt it is).
Looks like an issue with the method, because imageIdx is just a 
dictionary, sys.maxint is a (surprise!) integer, and name is a string.

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Kevin Walzer

On 1/23/11 8:33 PM, rantingrick wrote:


Well wxPython ha a treectrl too. And if we were comparing apples to
apples then we would compare the wx.TreeCtrl to the Tk::TreeCtrl.
However there are many things that a ListCtrl can do that a treectrl
can't. The biggest difference COLUMNS


The ttk::treeview widget can also function as a multi-column listbox, 
and can include both tree and multi-column listbox features in a single 
window. It's a very flexible widget.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute foreing code from Python

2011-01-23 Thread Hidura
Thanks to all for your fast responses. I will use this on a server
running on Linux, so there is no problem with the OS and probably i
will try to pipes and subprocess, but the pipes worry me because i
can't stop the process using timeout or i don't found how to stop
it...


2011/1/23, Dan Stromberg :
> On Sun, Jan 23, 2011 at 4:24 PM, Dave Angel  wrote:
>> On 01/-10/-28163 02:59 PM, hid...@gmail.com wrote:
>>>
>>> Hello i want to code from different languages using a Python script i
>>> know i can use os.system, but i don't know how to receive data or send
>>> arguments using that method if theres any another way to make it or
>>> there's a way to send arguments and receive data using os.system?
>>>
>>> Thanks in advance.
>>>
>>
>> That sentence runs on, and makes no sense to me.  But I can guess that you
>> would like to be able to write code in other languages, and call it from
>> within a Python script.
>
> Well, clearly it made some sense, or you wouldn't be responding.
>
>> If you're on Windows, and the other language is a compiled one like C,
>> compile it into a DLL, and call that DLL from Python.  Ctypes is the first
>> module to study.
>
> The DLL is but a weak mimicry of what *ix had for a long time before.
> On most *ix's, the .so is the analog to the windows DLL, though only
> AIX appears to suffer from the same kind of "DLL hell" that windows
> suffers from (which makes some historical if not technical sense,
> given that windows is related to OS/2, which like AIX is also from
> IBM).  Using a .so, you can still use ctypes.  You also have the
> option of using Cython, which is perhaps a bit better supported on
> *ix, but will likely now work on windows too.
>
>> If you're on Linux, and the code in the other language was written by
>> someone else, and is already compiled into an executable you cannot
>> change,
>
> This is rare on Linux - almost everything is changeable on Linux,
> because it is almost entirely opensource - sometimes entirely so,
> depending on distribution choice and what 3rd party apps you install
> after the OS install.
>
>> you probably should invoke it using the subprocess module.
>
> This is an option on almost any OS, and in fact is probably a pretty
> good one on almost any OS, even if you do have source.  Sadly, few
> windows programs are written to take advantage of this, perhaps
> because of the historical (dos/windows) command.com's fake pipes.
>
> You can communicate with a subprocess using pipes, or command line
> arguments, or files, or sockets, or shared memory.  There are probably
> other options that aren't coming to mind just now.  But usually, using
> pipes gives the loosest (best) coupling between processes.
>
> Microsoft appears to have recognized this to some extent by releasing
> powershell - though it uses object pipes rather than byte stream
> pipes.  Object pipes appear to require less serialization, but also
> appear to be less loosely coupled.  For remote pipes, powershell
> serializes to XML, while *ix pipes serialize exactly the same way
> remote local or remote.
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 8:06 pm, Corey Richardson  wrote:

> > Columns Corey, the key word here is "columns". One more
> > time...COOLUUUMMMNNN. Is this starting to sink in yet
> > Corey?
>
> I sent that email before you sent your email explaining why (responded
> to Kevin), sorry that I can't see the future.

Don't worry, I forgive you Corey. We can't *all* be visionaries ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 8:07 pm, Corey Richardson  wrote:

> because imageIdx is just a dictionary,

No, imageIdx is an integer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 23, 8:16 pm, Kevin Walzer  wrote:

> The ttk::treeview widget can also function as a multi-column listbox,
> and can include both tree and multi-column listbox features in a single
> window. It's a very flexible widget.

Can we see some working code? I would love to see some code Kevin. You
might satisfy the column requirement however you also need editable
labels and two veiw modes;  reportview and listview. Actually it
sounds pretty much like a (wait for it...) TreeCtrl to me.

PS: Be sure not to cause any segfaults because these linux folks can't
debug for shite!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 09:29 PM, rantingrick wrote:

On Jan 23, 8:07 pm, Corey Richardson  wrote:


because imageIdx is just a dictionary,


No, imageIdx is an integer.


You're right.
imageIdx = self.imageMap[iconname]

I confused imageIdx with self.imageMap. But that still doesn't fix my 
problem, so before I go diving into the wxPython source, anyone have a 
'quick fix'?

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rantingrick
On Jan 22, 6:07 pm, rantingrick  wrote:

> I await any challengers...

CODE UPDATE:

 * removed sys.maxint (not sure how it got there?)


https://sites.google.com/site/thefutureofpython/home/code-challenges
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Steven D'Aprano
On Sun, 23 Jan 2011 17:50:24 -0800, rantingrick wrote:

> On Jan 23, 7:40 pm, Corey Richardson  wrote:
> 
>> Why can't we use a TreeCtrl? If we can't use all our widgets, why can
>> you use all yours?
>>
>> ~Corey
> 
> Columns Corey, the key word here is "columns". One more
> time...COOLUUUMMMNNN. Is this starting to sink in yet Corey?

When I run the code snippet Martin provided under Linux, the file 
selection box shows files in columns. That's part of the reason why I 
consider it ugly -- I'm an old Mac guy, and I still dislike file 
selection tools that use the Windows 95 style 2-D layout:


a-file  e-file  ...
b-file  f-file  y-file
c-file  g-file  z-file
d-file  h-file


instead of a simple vertical list:

a-file
b-file
c-file
...
z-file


Call me a dinosaur if you will, but I hate horizontal scrolling.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A and B but not C in list

2011-01-23 Thread Ian Kelly
On Sun, Jan 23, 2011 at 2:34 PM, Christian Heimes  wrote:
> your_set = set(your_list)
>
> if your_set.issuperset(set([A, B])) and your_set.isdisjoint(set([C, D])):

if your_set.intersection([A, B, C, D]) == set([A, B]):
...

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Corey Richardson

On 01/23/2011 09:47 PM, rantingrick wrote:

On Jan 22, 6:07 pm, rantingrick  wrote:


I await any challengers...


CODE UPDATE:

  * removed sys.maxint (not sure how it got there?)


https://sites.google.com/site/thefutureofpython/home/code-challenges


In the example at 
http://www.wxpython.org/OSCON2004/advanced/wxPython-Advanced-OSCON2004.pdf 
they use sys.maxint, which may be where you got it (wild shot in the dark!).


The following result in a segfault:
---item-1-
list_item = wx.ListItem()
list_item.SetId(idx)
list_item.SetText(name)
list_item.SetWidth(50)
index = self.InsertItem(list_item)
---end

--item-2--
self.InsertStringItem(idx, name)
---end


The following will launch the application:
(drop in replacement for line 151):

index = self.SetStringItem(idx, 0, name)

No idea why, I've never used wxPython before today.
Unfortunately, it doesn't actually show the items in the directory.
Since I'm definitely not a wxPython user, would you mind making the
above work, rantingrick? Not trying to worm out of anything, but this
is way over my head.

~Corey
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Littlefield, Tyler

>PS: Be sure not to cause any segfaults because these linux folks can't
>debug for shite!
Or maybe it is that the person fighting and throwing insults around like 
candy at a parade can't code for shite. Or *gasp* the library that is 
supposedly cross-platform has issues on certain platforms. You provided 
a challenge to show how superior wxPython was. If it segfaults, that 
tells me that: 1) you can't code worth "shite," or 2) the library you 
are drooling over sucks and shouldn't be cross-platform. Which is it? I 
highly doubt there is a third option, but please feel free to tell me, 
rather than insulting again.

On 1/23/2011 7:34 PM, rantingrick wrote:

On Jan 23, 8:16 pm, Kevin Walzer  wrote:


The ttk::treeview widget can also function as a multi-column listbox,
and can include both tree and multi-column listbox features in a single
window. It's a very flexible widget.

Can we see some working code? I would love to see some code Kevin. You
might satisfy the column requirement however you also need editable
labels and two veiw modes;  reportview and listview. Actually it
sounds pretty much like a (wait for it...) TreeCtrl to me.

PS: Be sure not to cause any segfaults because these linux folks can't
debug for shite!



--

Thanks,
Ty

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread rusi
On Jan 24, 9:16 am, "Littlefield, Tyler"  wrote:
>  >PS: Be sure not to cause any segfaults because these linux folks can't
>  >debug for shite!
> Or maybe it is that the person fighting and throwing insults around like
> candy at a parade can't code for shite. Or *gasp* the library that is
> supposedly cross-platform has issues on certain platforms. You provided
> a challenge to show how superior wxPython was. If it segfaults, that
> tells me that: 1) you can't code worth "shite," or 2) the library you
> are drooling over sucks and shouldn't be cross-platform. Which is it? I
> highly doubt there is a third option, but please feel free to tell me,
> rather than insulting again.

I think there is a third option
About rr's code-ing ability... this thread is long enough  :-)
Likewise if a certain library not in python standard distribution does
not work properly its the problem of the library.
But if python crashes its not good for the image of python.

Personal note 1: I am often teaching python with code I am seeing for
the first time -- typically something the class presents me which we
understand/debug/refactor together.
Usually I am not afraid of python because errors are helpful and
gentle.
Segfaulting on the other hand is the last thing I want to see in such
a context :-)

Personal note 2: I dont regard myself as a gui programmer and Ive
often wondered which toolkit to demonstrate.  I probably wont be
looking at wx now unless someone gives a convincing argument that the
segfault did not happen "inside" wx.

Of course as Steven pointed out wx is written in C++ which is almost
certainly where the crash is occurring.
But this is technical nitpicking.
The real issue is that when coding in C/C++ segfaults are a daily
affair.
Whereas for python its the first time I am seeing it in 10 years...
-- 
http://mail.python.org/mailman/listinfo/python-list


Get input in Python

2011-01-23 Thread Santhosh Kumar
Hi all,
  I am trying to get input from the file* open(sys.argv[1]). *So,
while executing I will refer it as python filename.py  sample_file.txt  this
will root to my sys.argv[]. So I need to follow the same but I also need to
give input Example :  python filename.py  . How
should I do coding for this.

Thanks in Advance,
Santhosh V.Kumar
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Get input in Python

2011-01-23 Thread Chris Rebert
On Sun, Jan 23, 2011 at 10:10 PM, Santhosh Kumar
 wrote:
> Hi all,
>           I am trying to get input from the file open(sys.argv[1]). So,
> while executing I will refer it as python filename.py  sample_file.txt  this
> will root to my sys.argv[]. So I need to follow the same but I also need to
> give input Example :  python filename.py  . How
> should I do coding for this.

Just access the text using sys.argv like before. It's just another
element in the list; there's nothing special about it. You just need
to change the indices accordingly:

from sys import argv
text = argv[1]
filepath = argv[2]
# alternatively:
# text, filepath = argv[1:]
print("Your text input was:")
print(text)
print("The file's contents are:")
with file(filepath, 'r') as f:
print(f.read())

Usage:
$ python 'Hello there Santhosh' something.txt
Your text input was:
Hello there Santhosh
The file's contents are:


Note that the text is quoted; this is required if your text contains
spaces and/or shell special characters.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Converting functions

2011-01-23 Thread iu2
Hi all,

I'm trying to convert functions - pass a few functions to a converting
function, which change their behaviour and return the changed
functions:

>>> def cfuncs(*funcs):
n = []
for f in funcs:
def ff(*args, **key):
print 'Start!', f.func_name
res = f(*args, **key)
print 'End', f.func_name
return res
n.append(ff)
return n

then I try it using two functions:

>>> def f1():
print 'hello'


>>> def f2(x):
return 2 * x

Eventually:
>>> newfuncs = cfuncs(f1, f2)

I would expect newfuncs to hold changed versions of f1 and f2, but
what is actually contained in newfuncs is twice the changed version of
f2.

That is:

>>> newfuncs[1](100)
Start! f2
End f2
200

which is what I expected,

but:

>>> newfuncs[0]()
Start! f2

Traceback (most recent call last):
  File "", line 1, in 
newfuncs[0]()
  File "", line 6, in ff
res = f(*args, **key)
TypeError: f2() takes exactly 1 argument (0 given)

which is not.

I'll appreciate your help in pointing out the mistake in defining
cfuncs and how to fix it.
Thank you very much!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Code Challenge] WxPython versus Tkinter.

2011-01-23 Thread Octavian Rasnita

From: "Kevin Walzer" 
I found this code in the Demo/tkinter/ttk directory of the Python 2.7.1 
source distribution. I'm NOT the author (credit should probably go to 
Guilherme Polo, developer of the Tkinter wrapper for the ttk themed widgets 
that is now in the stdlib). But, using a tree/listview widget that is part 
of the Tk/Tkinter core (NOT an extension),  it presents a decent, simple 
file browser:





Well, I have also tested the program dirbrowser.py, but it is not decent at 
all.

I have tested it with JAWS screen reader and it is absolutely inaccessible.

The single "accessible" things in it are the title bar which is "tk".
It can't compare with the same program made using WxPython.
And it can't be made to be more accessible than it is, because it uses Tk.

So Tkinter is really bad.

Octavian

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Octavian Rasnita

From: "Littlefield, Tyler" 

>PS: Be sure not to cause any segfaults because these linux folks can't
>debug for shite!
Or maybe it is that the person fighting and throwing insults around like 
candy at a parade can't code for shite. Or *gasp* the library that is 
supposedly cross-platform has issues on certain platforms. You provided a 
challenge to show how superior wxPython was. If it segfaults, that tells 
me that: 1) you can't code worth "shite," or 2) the library you are 
drooling over sucks and shouldn't be cross-platform. Which is it? I highly 
doubt there is a third option, but please feel free to tell me, rather 
than insulting again.



Hi Tyler,

Are you able to use Tkinter-based applications under Windows?
Or you have started to use Linux and now you don't care about the majority 
of users that need to use a screen reader?


Octavian

--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Octavian Rasnita

From: "rantingrick" 
On Jan 23, 5:44 pm, "Martin v. Loewis"  wrote:

> For something as common as displaying a file browser, it should be as
> simple as this:

> import gui_toolkit # whichever
> path = gui_toolkit.select_file()

> Something like zenity:

> [steve@sylar ~]$ zenity --file-selection
> /home/steve/python/findsingle.py

And indeed, it is that simple:

python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"



Martin the tkFileDialog.ask* uses the platform specific Open, Save
dialogs which DO contain a ListCtrl. Obviously this ListCtrl is not
available to Tkinter uses. You just exposed your weak knowledge of
Tkinter and sadly you are very high on the community totem pole. Very
sad :(




Aha, that's why that Open File window was accessible for JAWS screen reader, 
although it uses Tk... because actually it doesn't use Tk.


Octavian

--
http://mail.python.org/mailman/listinfo/python-list


switch from default env to virtualenv and back in script

2011-01-23 Thread fara
Hi,
My default environment uses Python2.6 but I have a also virtualenv with 
Python2.7 with different packages. Is it possible to write a script where some 
parts are executed in the default Python2.6 environment and some others in the 
Python2.7 virtualenv. Something like this:

# Start of pseudoscript
import (Python2.6) packages
execute code in Python2.6
switch to Python2.7 virtualenv
import (Python2.7) packages
execute code in the Python2.7 virtualenv and store information for later use
switch back to default Python2.6
import (Python2.6) packages
execute Python2.6 functions
# End of pseudoscript

Thanks
Fara


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-01-23 Thread Noah Hall
On Sun, Jan 23, 2011 at 5:31 PM, rantingrick  wrote:
> So far only trolls (besides Terry, Octavian, D'Aprano) have replied.
> In my time here within the Python community i have only met one person
> who shares my in-depth knowledge of Tkinter. That person is Kevin
> Waltzer. So outside of Python-dev and Guido. Kevin and I are are the
> ONLY people qualified to offer opinions on the worth or worthlessness
> of Tkinter. If anyone in this entire community thinks that they also
> are qualified then prove your worth by creating a ListCtrl in Tkinter
> that mirrors the wxPython ListCtrl in functionality. When you have
> done that, i will elevate you to my circle of enlightenment. Than and
> only then shall i even entertain you BS.


Wow, someone's certainly feeling very self-important, ignoring the
fact he can't follow conventions nor write cross-platform software.
And before you start, no, I don't want to steal your "file browser".
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting functions

2011-01-23 Thread Peter Otten
iu2 wrote:

> I'm trying to convert functions - pass a few functions to a converting
> function, which change their behaviour and return the changed
> functions:
> 
> >>> def cfuncs(*funcs):
> n = []
> for f in funcs:
> def ff(*args, **key):
> print 'Start!', f.func_name
> res = f(*args, **key)
> print 'End', f.func_name
> return res
> n.append(ff)
> return n
> 
> then I try it using two functions:
> 
> >>> def f1():
> print 'hello'
> 
> 
> >>> def f2(x):
> return 2 * x
> 
> Eventually:
> >>> newfuncs = cfuncs(f1, f2)
> 
> I would expect newfuncs to hold changed versions of f1 and f2, but
> what is actually contained in newfuncs is twice the changed version of
> f2.

That is because the inner ff() references f which is a local variable of 
cfuncs(). By the time you invoke your newly created functions cfuncs() and 
thus the 'for f in funcs' loop has finished and the value of f is that of 
the last item in the funcs tuple. You can avoid the problem with another 
indirection

def make_ff(f):
def ff(*args, **key):
print 'Start!', f.func_name
res = f(*args, **key)
print 'End', f.func_name
return res
return ff 

def cfuncs(*funcs):
return [make_ff(f) for f in funcs]

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list