From high.res.mike at gmail.com  Mon Feb 11 14:13:51 2008
From: high.res.mike at gmail.com (Mike Pfaiffer)
Date: Mon, 11 Feb 2008 13:13:51 -0600
Subject: [Python Wpg] Python and graphics
Message-ID: <47B09E6F.2030703@gmail.com>

	My cousin wants me to write a custom stand-alone application for him. I 
figured Python might be the best way to keep it as platform generic as 
possible. He has a laptop and pocket PC. He uses Windows and I don't. I 
have never programmed for a GUI based operating system. Is there a 
simple library of routines I could use to display text, get input from 
the user, and output data to a text file? I guess I already know how to 
do the last bit... ;-)

	Essentially he wants to generate reports based on data he inputs on site.

	The design of the program is not a problem. Once I know what questions 
he wants to ask it is easy. The user interface is the tough part.

				Later
				Mike



From stuartw at mts.net  Wed Feb 13 11:40:37 2008
From: stuartw at mts.net (Stuart Williams)
Date: Wed, 13 Feb 2008 10:40:37 -0600
Subject: [Python Wpg] Python and graphics
In-Reply-To: <47B09E6F.2030703@gmail.com>
References: <47B09E6F.2030703@gmail.com>
Message-ID: <db6e78040802130840m6d032339u2d0a0b75af4e04e4@mail.gmail.com>

You have several options.  The most popular seem to be PyGTK and
wxPython.  Older references on the internet point towards PyGTK being
more suitable for developing for Linux if you also need Windows, but
more recent references say PyGTK installers on Windows are mature
enough.   However it doesn't yet support Macs well as far as I can
tell. The wxPython toolkit on the other hand uses native GUI libraries
on each platform and supports Macs.

I've not used either of these but I was researching them recently so
take my answer with a grain of salt.

Stuart.

On Feb 11, 2008 1:13 PM, Mike Pfaiffer <high.res.mike at gmail.com> wrote:
>  ... Is there a
> simple library of routines I could use to display text, get input from
> the user, and output data to a text file?...


From aklaassen at gmail.com  Wed Feb 13 11:56:36 2008
From: aklaassen at gmail.com (Aaron Klaassen)
Date: Thu, 14 Feb 2008 00:56:36 +0800
Subject: [Python Wpg] Python and graphics
In-Reply-To: <db6e78040802130840m6d032339u2d0a0b75af4e04e4@mail.gmail.com>
References: <47B09E6F.2030703@gmail.com>
	<db6e78040802130840m6d032339u2d0a0b75af4e04e4@mail.gmail.com>
Message-ID: <faa9c35c0802130856s115e93e6y9c2b0911ccb6497@mail.gmail.com>

wxPython has been working pretty well for me so far, though I haven't
written anything very complex (and nothing complete...planning on sitting
and writing a bunch of code this weekend :). The
cross-platform-and-native-widgets thing is a pretty big plus, if you ask me.
And wxGlade <http://wxglade.sourceforge.net/> seems handy, though I haven't
used that much yet at all.

I haven't actually tried any wxPython apps on Windows or OS X though. So
likewise take advice with salt.

Aaron.



On Feb 14, 2008 12:40 AM, Stuart Williams <stuartw at mts.net> wrote:

> You have several options.  The most popular seem to be PyGTK and
> wxPython.  Older references on the internet point towards PyGTK being
> more suitable for developing for Linux if you also need Windows, but
> more recent references say PyGTK installers on Windows are mature
> enough.   However it doesn't yet support Macs well as far as I can
> tell. The wxPython toolkit on the other hand uses native GUI libraries
> on each platform and supports Macs.
>
> I've not used either of these but I was researching them recently so
> take my answer with a grain of salt.
>
> Stuart.
>
> On Feb 11, 2008 1:13 PM, Mike Pfaiffer <high.res.mike at gmail.com> wrote:
> >  ... Is there a
> > simple library of routines I could use to display text, get input from
> > the user, and output data to a text file?...
> _______________________________________________
> Winnipeg mailing list
> Winnipeg at python.org
> http://mail.python.org/mailman/listinfo/winnipeg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/winnipeg/attachments/20080214/d5be77aa/attachment.html>

From high.res.mike at gmail.com  Wed Feb 13 17:01:56 2008
From: high.res.mike at gmail.com (Mike Pfaiffer)
Date: Wed, 13 Feb 2008 16:01:56 -0600
Subject: [Python Wpg] Python and graphics
In-Reply-To: <faa9c35c0802130856s115e93e6y9c2b0911ccb6497@mail.gmail.com>
References: <47B09E6F.2030703@gmail.com>	
	<db6e78040802130840m6d032339u2d0a0b75af4e04e4@mail.gmail.com>
	<faa9c35c0802130856s115e93e6y9c2b0911ccb6497@mail.gmail.com>
Message-ID: <47B368D4.6070005@gmail.com>

Aaron Klaassen wrote:
> wxPython has been working pretty well for me so far, though I haven't 
> written anything very complex (and nothing complete...planning on 
> sitting and writing a bunch of code this weekend :). The 
> cross-platform-and-native-widgets thing is a pretty big plus, if you ask 
> me. And wxGlade <http://wxglade.sourceforge.net/> seems handy, though I 
> haven't used that much yet at all.
> 
> I haven't actually tried any wxPython apps on Windows or OS X though. So 
> likewise take advice with salt.
> 
> Aaron.

	Thanks for the advice everybody. Jason also suggested wxwidgets. As I 
get more than a few consecutive minutes together I will be looking at 
everything everybody suggested. I don't want to pre-judge anything 
before I try it. I suppose the best way to start is to see what I can do 
on one machine and try it on another. Then tell my cousin to install 
Python on his M$ box and try it there.

	The last actual graphics programming I did was on an Apple IIGS. This 
is going to be a real adventure.

				Later
				Mike



> On Feb 14, 2008 12:40 AM, Stuart Williams <stuartw at mts.net 
> <mailto:stuartw at mts.net>> wrote:
> 
>     You have several options.  The most popular seem to be PyGTK and
>     wxPython.  Older references on the internet point towards PyGTK being
>     more suitable for developing for Linux if you also need Windows, but
>     more recent references say PyGTK installers on Windows are mature
>     enough.   However it doesn't yet support Macs well as far as I can
>     tell. The wxPython toolkit on the other hand uses native GUI libraries
>     on each platform and supports Macs.
> 
>     I've not used either of these but I was researching them recently so
>     take my answer with a grain of salt.
> 
>     Stuart.
> 
>     On Feb 11, 2008 1:13 PM, Mike Pfaiffer <high.res.mike at gmail.com
>     <mailto:high.res.mike at gmail.com>> wrote:
>      >  ... Is there a
>      > simple library of routines I could use to display text, get input
>     from
>      > the user, and output data to a text file?...
>     _______________________________________________
>     Winnipeg mailing list
>     Winnipeg at python.org <mailto:Winnipeg at python.org>
>     http://mail.python.org/mailman/listinfo/winnipeg
> 
> 



From syd at plug.ca  Thu Feb 21 15:56:31 2008
From: syd at plug.ca (Sydney Weidman)
Date: Thu, 21 Feb 2008 14:56:31 -0600
Subject: [Python Wpg] Question about cx_Oracle
Message-ID: <1203627391.15450.13.camel@localhost>

I'm not sure if anyone on the list has had experience with oracle
databases and/or cx_Oracle. I'm having a heck of a time figuring out why
the code below doesn't work. get_total() returns the proper value, i.e.
COUNT(RECORD_NUM), but when I parameterize the query (get_total_loc) by
adding :loc and setting a value for it (the same value as in the literal
LOCATION = 'main'), it always returns 0 with no errors. Here is sample
output:

Total with literal location is 31861
Total with parameterized location is: 0

And I get the same result if I use 

        cursor.setinputsizes(d_start=cx_Oracle.DATETIME,
                             d_end=cx_Oracle.DATETIME,
                             loc=8)
instead of:

        cursor.setinputsizes(d_start=cx_Oracle.DATETIME,
                             d_end=cx_Oracle.DATETIME,
                             loc=cx_Oracle.STRING)

I have also made certain that the value of loc is 'main' when it is
passed to cursor.execute() by setting it explicitly.

Thanks in advance for any assistance.

Regards,
Syd

import sys
import datetime
import config
try:
    import cx_Oracle
except ImportError, e:
    print "Cannot import cx_Oracle:", e


def get_total_loc(loc):
    d_start = datetime.date(2005,12,31)
    d_end = datetime.date(2007,1,1)
    dsn = cx_Oracle.makedsn(config.hostname, config.port, config.database)
    conn = cx_Oracle.connect(config.login, config.password, dsn)
    try:
        cursor = conn.cursor()
        query = """SELECT COUNT(RECORD_NUM)
                   FROM ITEM2BASE
                   WHERE LOCATION = :loc
                   AND LCHKIN BETWEEN :d_start AND :d_end"""
        cursor.setinputsizes(d_start=cx_Oracle.DATETIME,
                             d_end=cx_Oracle.DATETIME,
                             loc=cx_Oracle.STRING)
        cursor.prepare(query)
        cursor.execute(query,d_start=d_start, d_end=d_end, loc=loc)
        val = cursor.fetchone()[0]
    finally:
        conn.close()
    return val

def get_total():
    d_start = datetime.date(2005,12,31)
    d_end = datetime.date(2007,1,1)
    dsn = cx_Oracle.makedsn(config.hostname, config.port, config.database)
    conn = cx_Oracle.connect(config.login, config.password, dsn)
    try:
        cursor = conn.cursor()
        query = """SELECT COUNT(RECORD_NUM)
                   FROM ITEM2BASE
                   WHERE LOCATION = 'main' AND
                   LCHKIN BETWEEN :d_start AND :d_end"""
        cursor.setinputsizes(d_start=cx_Oracle.DATETIME,
                             d_end=cx_Oracle.DATETIME)
        cursor.execute(query,d_start=d_start,d_end=d_end)
        val = cursor.fetchone()[0]
    finally:
        conn.close()
    return val

def main():
    print "Total with literal location is %d" % get_total()
    print "Total with parameterized location is: %d" % get_total_loc('main')
    return 0

if __name__ == '__main__':

    sys.exit(main())
    




From stuartw at mts.net  Thu Feb 21 22:30:08 2008
From: stuartw at mts.net (Stuart Williams)
Date: Thu, 21 Feb 2008 21:30:08 -0600
Subject: [Python Wpg] Meeting this coming Wednesday February 27th
Message-ID: <18366.16832.135269.636545@gavel.swilliams.ca>

At our January meeting I presented a subset of my upcoming PyCon
tutorial.  I'd be happy to present some more of it.  The feedback is
very helpful.

I have some interesting sections from the "Python 102" second half of
the tutorial that I think would interest many of you, such as peering
behind the scenes for iterators and classes.

How does this sound?

Stuart.


From syd at plug.ca  Fri Feb 22 10:08:19 2008
From: syd at plug.ca (Sydney Weidman)
Date: Fri, 22 Feb 2008 09:08:19 -0600
Subject: [Python Wpg] Meeting this coming Wednesday February 27th
In-Reply-To: <18366.16832.135269.636545@gavel.swilliams.ca>
References: <18366.16832.135269.636545@gavel.swilliams.ca>
Message-ID: <1203692899.6097.6.camel@localhost>

On Thu, 2008-21-02 at 21:30 -0600, Stuart Williams wrote:
> At our January meeting I presented a subset of my upcoming PyCon
> tutorial.  I'd be happy to present some more of it.  The feedback is
> very helpful.
> 
> I have some interesting sections from the "Python 102" second half of
> the tutorial that I think would interest many of you, such as peering
> behind the scenes for iterators and classes.
> 
> How does this sound?
> 
> Stuart.

sounds good to me.







From high.res.mike at gmail.com  Fri Feb 22 18:53:32 2008
From: high.res.mike at gmail.com (Mike Pfaiffer)
Date: Fri, 22 Feb 2008 17:53:32 -0600
Subject: [Python Wpg] Minor headache with substrings
Message-ID: <47BF607C.4070504@gmail.com>

	First off this is a precursor to my first adventure with GUI 
programming. I figured I'd write something which works first and then 
add a GUI to it.

	I want to split a rather large string (< 2,000,000 characters) at 
random locations. The resulting substrings get sent out to a file for 
later reassembly. At this point it is only coincidental the substrings 
are sequential to each other. I've been using 
"original_string[start:length]" to copy the data to a second string 
which goes to the output file. I'm able to calculate the start for the 
subsequent substrings correctly. However when putting the substring in a 
second variable I occasionally get a length of 1 (which should never 
occur). Seeing this problem on the screen, I now think I'm missing 
something. I think it could be in one of three areas. Either it's 
something about the nature of strings in Python. Maybe I should be using 
a different procedure to take out substrings. Or there is a problem with 
the size of "start" or "length". So I suppose my question is am I on the 
right track with this?

				Later
				Mike



From stuartw at mts.net  Fri Feb 22 19:58:37 2008
From: stuartw at mts.net (Stuart Williams)
Date: Fri, 22 Feb 2008 18:58:37 -0600
Subject: [Python Wpg] Minor headache with substrings
In-Reply-To: <47BF607C.4070504@gmail.com>
References: <47BF607C.4070504@gmail.com>
Message-ID: <db6e78040802221658q23257724r3510e98d7a00d296@mail.gmail.com>

You wrote original_string[start:length], that should be
original_string[start:stop].  Does that indicate a misunderstanding
about strings that could explain the behaviour your seeing?

If you send sample code I could investigate further.

Stuart.

On Fri, Feb 22, 2008 at 5:53 PM, Mike Pfaiffer <high.res.mike at gmail.com> wrote:
>         First off this is a precursor to my first adventure with GUI
>  programming. I figured I'd write something which works first and then
>  add a GUI to it.
>
>         I want to split a rather large string (< 2,000,000 characters) at
>  random locations. The resulting substrings get sent out to a file for
>  later reassembly. At this point it is only coincidental the substrings
>  are sequential to each other. I've been using
>  "original_string[start:length]" to copy the data to a second string
>  which goes to the output file. I'm able to calculate the start for the
>  subsequent substrings correctly. However when putting the substring in a
>  second variable I occasionally get a length of 1 (which should never
>  occur). Seeing this problem on the screen, I now think I'm missing
>  something. I think it could be in one of three areas. Either it's
>  something about the nature of strings in Python. Maybe I should be using
>  a different procedure to take out substrings. Or there is a problem with
>  the size of "start" or "length". So I suppose my question is am I on the
>  right track with this?
>
>                                 Later
>                                 Mike
>
>  _______________________________________________
>  Winnipeg mailing list
>  Winnipeg at python.org
>  http://mail.python.org/mailman/listinfo/winnipeg
>


From high.res.mike at gmail.com  Fri Feb 22 21:19:37 2008
From: high.res.mike at gmail.com (Mike Pfaiffer)
Date: Fri, 22 Feb 2008 20:19:37 -0600
Subject: [Python Wpg] Minor headache with substrings
In-Reply-To: <db6e78040802221658q23257724r3510e98d7a00d296@mail.gmail.com>
References: <47BF607C.4070504@gmail.com>
	<db6e78040802221658q23257724r3510e98d7a00d296@mail.gmail.com>
Message-ID: <47BF82B9.7060202@gmail.com>

Stuart Williams wrote:
> You wrote original_string[start:length], that should be
> original_string[start:stop].  Does that indicate a misunderstanding
> about strings that could explain the behaviour your seeing?

	Very much so. I suppose I should increase the font size while reading 
manuals. ;-) If the second part is "stop" and not "length" then I could 
end up trying to get negative offsets into the string. Since I append an 
EOLN then that would explain why I get lengths of 1.

> If you send sample code I could investigate further.

	I'm wiped out at the moment. I also want to try a rewrite with the new 
information first. I think this explains everything. I may have to take 
care of a couple off by one bugs and out of range errors but I think 
this may take care of the major part of what I'm doing. Thanks.

	If you want, I'll bring in the code on Wednesday and show you before 
the meeting.

> Stuart.

				Later
				Mike


> On Fri, Feb 22, 2008 at 5:53 PM, Mike Pfaiffer <high.res.mike at gmail.com> wrote:
>>         First off this is a precursor to my first adventure with GUI
>>  programming. I figured I'd write something which works first and then
>>  add a GUI to it.
>>
>>         I want to split a rather large string (< 2,000,000 characters) at
>>  random locations. The resulting substrings get sent out to a file for
>>  later reassembly. At this point it is only coincidental the substrings
>>  are sequential to each other. I've been using
>>  "original_string[start:length]" to copy the data to a second string
>>  which goes to the output file. I'm able to calculate the start for the
>>  subsequent substrings correctly. However when putting the substring in a
>>  second variable I occasionally get a length of 1 (which should never
>>  occur). Seeing this problem on the screen, I now think I'm missing
>>  something. I think it could be in one of three areas. Either it's
>>  something about the nature of strings in Python. Maybe I should be using
>>  a different procedure to take out substrings. Or there is a problem with
>>  the size of "start" or "length". So I suppose my question is am I on the
>>  right track with this?
>>
>>                                 Later
>>                                 Mike
>>
>>  _______________________________________________
>>  Winnipeg mailing list
>>  Winnipeg at python.org
>>  http://mail.python.org/mailman/listinfo/winnipeg
>>
>