Re: Functions vs OOP

2011-09-05 Thread William Gill
On 9/5/2011 3:04 PM, Jean-Michel Pichavant wrote: William Gill wrote: Not to split hairs, but syntactically f(x) is a function in many programming paradigms. As I understand it functional programming places specific requirements on functions, i.e.referential transparency. So f(x) may or may

Re: Functions vs OOP

2011-09-05 Thread William Gill
On 9/3/2011 12:25 PM, Steven D'Aprano wrote: William Gill wrote: Are they suggesting that any function that takes an object as an argument should always be a method of that object? Yes. I can think of times when a special application, such as a converter, would take an object

Re: Functions vs OOP

2011-09-05 Thread William Gill
On 9/4/2011 9:13 AM, rusi wrote: On Sep 3, 9:15 pm, William Gill wrote: During some recent research, and re-familiarization with Python, I came across documentation that suggests that programming using functions, and programming using objects were somehow opposing techniques. Staying with

Re: Functions vs OOP

2011-09-04 Thread William Gill
On 9/4/2011 7:41 PM, Steven D'Aprano wrote: William Gill wrote: The source of my error is "Functional Programming HOWTO (/python-3.1.3-docs-html/howto/functional.html)" For those who don't have access to William's local file system, I expect he's looking at

Re: Functions vs OOP

2011-09-04 Thread William Gill
On 9/4/2011 2:32 PM, Terry Reedy wrote: On 9/4/2011 4:13 AM, tinn...@isbd.co.uk wrote: Ian Kelly wrote: Functional programming is about using functions in the *mathematical* sense. A mathematical function maps one value (or tuple of values) to another value. The mapped value never varies; if

Re: Functions vs OOP

2011-09-03 Thread William Gill
On 9/3/2011 9:51 PM, Terry Reedy wrote: It is possible that our doc was less than crystal clear. We are constantly improving it where we can see fixable faults. If you run across whatever it was and it still seems a bit muddy, post something again. Will do. Thanks. -- http://mail.python.org/m

Re: Functions vs OOP

2011-09-03 Thread William Gill
On 9/3/2011 5:39 PM, Ben Finney wrote: William Gill writes: On 9/3/2011 3:15 PM, Terry Reedy wrote: William Gill wrote: During some recent research, and re-familiarization with Python, I came across documentation Ours, or someone else's? Python. Can you show exactly where i

Re: Functions vs OOP

2011-09-03 Thread William Gill
On 9/3/2011 3:15 PM, Terry Reedy wrote: William Gill wrote: During some recent research, and re-familiarization with Python, I came across documentation Ours, or someone else's? Python. Since in Python, everything is an object, that would mean that every function has to be a m

Re: Functions vs OOP

2011-09-03 Thread William Gill
On 9/3/2011 2:50 PM, Ian Kelly wrote: I think you may be confusing "functional programming" and "programming using functions". These are not the same thing. I think you may be right, Ian. It didn't make much sense -- http://mail.python.org/mailman/listinfo/python-list

Re: Functions vs OOP

2011-09-03 Thread William Gill
On 9/3/2011 12:29 PM, MRAB wrote: I think you mean "complementary". :-) How polite of you to point out my spelling deficiency. I guess shouldn't be watching football while typing (I'm sure the beer didn't help either). I think that it's all about "state". In functional programming, there's

Functions vs OOP

2011-09-03 Thread William Gill
During some recent research, and re-familiarization with Python, I came across documentation that suggests that programming using functions, and programming using objects were somehow opposing techniques. It seems to me that they are complimentary. It makes sense to create objects and have so

Re: Help parsing a text file

2011-09-01 Thread William Gill
On 9/1/2011 1:58 PM, JT wrote: On Monday, August 29, 2011 1:21:48 PM UTC-5, William Gill wrote: I have a text file with XML like records that I need to parse. By XML like I mean records have proper opening and closing tags. but fields don't have closing tags (they rely on line ends). No

Re: Help parsing a text file

2011-08-29 Thread William Gill
On 8/29/2011 2:31 PM, Philip Semanchuk wrote: If the syntax really is close to XML, would it be all that difficult to convert it to proper XML? Then you have nice libraries like ElementTree to use for parsing. Possibly, but I would still need the same search algorithms to find the opening

Help parsing a text file

2011-08-29 Thread William Gill
I haven't done much with Python for a couple years, bouncing around between other languages and scripts as needs suggest, so I have some minor difficulty keeping Python functionality Python functionality in my head, but I can overcome that as the cobwebs clear. Though I do seem to keep trippin

Re: simple games w/o pygame

2010-12-23 Thread William Gill
Thanks everyone. These references will help greatly. I was about to take some javascript examples and rewrite them in Python. -- http://mail.python.org/mailman/listinfo/python-list

simple games w/o pygame

2010-12-22 Thread William Gill
I am teaching an 11 year old who wants to learn programming. I chose Python, and it is working well. I seem to remember lots of simple script games, like quizzes, number games etc. that would be good for his tutorial. However, now all I can find is more complex games using Pygame. Can anyon

python script to act as list server

2008-11-16 Thread William Gill
Before I spend the next couple weeks researching and testing, can anyone tell me if what I want to do is possible, and possibly point me in the right direction to get started. I want to forward any email addressed to [EMAIL PROTECTED] to a python script that will forward it to all the other su

Re: smtp server simulation using Python

2007-06-24 Thread William Gill
Dave Borne wrote: >> I have a (web) development computer w/o an SMTP server and want to test >> form generated e-mail using a dummy SMTP server that delivers the mail >> message to a file, or better yet, to a text editor instead of actually >> sending it. > > Here's a quick and dirty script I us

smtp server simulation using Python

2007-06-17 Thread William Gill
I have a (web) development computer w/o an SMTP server and want to test form generated e-mail using a dummy SMTP server that delivers the mail message to a file, or better yet, to a text editor instead of actually sending it. Is it possible to extend the DebuggingServer class,and override the

Re: scroll a frame to display several lines of widgets at a time

2005-09-02 Thread William Gill
>yscroll = Tkinter.Scrollbar( , orient=Tkinter.VERTICAL) >yscroll.grid( ... ) >yscroll['command'] = canvas.yview >canvas['yscrollcommand'] = yscroll.set > Probably, not needed now that I have re-thought the situation, but I do have several occasio

Re: graphical or flow charting design aid for python class development?

2005-09-01 Thread William Gill
Thanks everyone. I will explore all the suggestions, but it looks like SPE is the immediate answer. Bill William Gill wrote: > Being somewhat new to Python, and having a tendency to over complicate > things in my class design, I was wondering if anyone can suggest a > simple gra

scroll a frame to display several lines of widgets at a time

2005-09-01 Thread William Gill
I need to display a couple of labels and a checkbox from each entry in my database. Simple enough, but there are several hundred records, and I only want to display 5 or 10 at a time. Can this be accomplished by putting everything in a Frame(), using width, height, grid_propagate(0) , and a s

Re: graphical or flow charting design aid for python class development?

2005-08-31 Thread William Gill
On first glance Doxygen doesn't look like the ticket, but the screen shots of Eric3 look VERY promising. I have already downloaded it, and will try it. Thanks, Bill tooper wrote: > You may want to use Doxygen, which generates nice diagrams. It's > normally only for C++, but there are nice filt

Re: graphical or flow charting design aid for python class development?

2005-08-31 Thread William Gill
loring, thanks. Bill > > http://www.python.org/doc/2.0.1/lib/module-pyclbr.html > > William Gill wrote: > >>Being somewhat new to Python, and having a tendency to over complicate >>things in my class design, I was wondering if anyone can suggest a >>simple graphica

graphical or flow charting design aid for python class development?

2005-08-31 Thread William Gill
Being somewhat new to Python, and having a tendency to over complicate things in my class design, I was wondering if anyone can suggest a simple graphical or flowcharting tool that they use to organize their class and program design? Because of a 55 mph head-on accident a few years back, I ha

a list of Checkbuttons

2005-08-29 Thread William Gill
OK I'm tired, I've got a cold, and my brain isn't working very well. I have a result set ( a tuple of tuples) from a db. Each element has two elements; classification number, and classification heading. i.e. result=((001,'heading one'),(002,'heading two'),...) classification numbers may not

Re: a question about tkinter StringVars()

2005-08-25 Thread William Gill
Eric Brunel wrote: > On Wed, 24 Aug 2005 15:07:27 GMT, William Gill <[EMAIL PROTECTED]> wrote: > >> Working with tkinter, I have a createWidgets() method in a class. >> Within createWidgets() I create several StringVars() and >> assign them to the textvari

prevent callback during initialization

2005-08-25 Thread William Gill
I am creating several tkinter widgets. In my classes they each have a change() method that is a callback to various IntVar, and StringVar objects. Everything works fine, but don't really want to trigger the callback when I am initializing each widget/control variable. I can use a "flag" like se

Re: a question about tkinter StringVars()

2005-08-24 Thread William Gill
Eric Brunel wrote: > On Wed, 24 Aug 2005 15:07:27 GMT, William Gill <[EMAIL PROTECTED]> wrote: > >> Working with tkinter, I have a createWidgets() method in a class. >> Within createWidgets() I create several StringVars() and >> assign them to the textvari

a question about tkinter StringVars()

2005-08-24 Thread William Gill
Working with tkinter, I have a createWidgets() method in a class. Within createWidgets() I create several StringVars() and assign them to the textvariable option of several widgets. Effectively my code structure is: def createWidgets(self): ... var = StringVar() Entry(master,textvar

tkinter text widget question

2005-08-21 Thread William Gill
The tkinter text widget uses indexes to identify row:column offsets within the text, but it seems counter intuitive to have to convert row and column integers to a string like "0.1'. It's great that index can take a string, but what about looping through rows and columns? Am I missing a way t

Re: tkinter text widget question

2005-08-21 Thread William Gill
rafi wrote: > William Gill wrote: > >> The tkinter text widget uses indexes to identify row:column offsets >> within the text, but it seems counter intuitive to have to convert row >> and column integers to a string like "0.1'. It's great that inde

Re: help with mysql cursor.execute()

2005-08-16 Thread William Gill
Dennis Lee Bieber wrote: > On Sun, 14 Aug 2005 19:28:04 GMT, William Gill <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>I have been trying to pass parameters as indicated in the api. >>when I use: >> >> sql= 's

Re: help with mysql cursor.execute()

2005-08-15 Thread William Gill
Steve Holden wrote: > William Gill wrote: > >> I have been testing and it seems that: >> >> 1- Cursor.execute does not like '?' as a placeholder in sql >> > The particular format required by each DBI-compatible module should be > available as t

Re: help with mysql cursor.execute()

2005-08-14 Thread William Gill
rks. Between your comments re: column names and table names , and the notes in cursor.py, I was able to figure it out. FYI I wanted to create a tableHandler class that could be extended for individual tables. That's why the query needs to accept variables for tablename. Thanks. Bill S

help with mysql cursor.execute()

2005-08-14 Thread William Gill
I have been trying to pass parameters as indicated in the api. when I use: sql= 'select * from %s where cusid = %s ' % name,recID) Cursor.execute(sql) it works fine, but when I try : sql= 'select * from %s where cusid like %s ' Cursor.execute(sql,(name,recID)) or sql= 'select *

Re: problem extending tkSimpleDialog.Dialog

2005-08-12 Thread William Gill
: class MyWidget(Frame): def __init__(self, master, columns,rows, trace_write=None): Frame.__init__(self,master) ... ... ... Bill P.S. I haven't been working on this since my last post. I had to quit to go see my oldest graduate. William Gill wrote: > I h

Re: problem extending tkSimpleDialog.Dialog

2005-08-12 Thread William Gill
rface it looks like I'm not passing the correct master reference to my frame. Bill William Gill wrote: > I have created a widget that extends Frame() and contains labels, > checkboxes, and entrys. I am trying to use tkSimpleDialog.Dialog to > create a modal display of this widget,

problem extending tkSimpleDialog.Dialog

2005-08-12 Thread William Gill
I have created a widget that extends Frame() and contains labels, checkboxes, and entrys. I am trying to use tkSimpleDialog.Dialog to create a modal display of this widget, but am running into some (addressing) problems. My widget displays in the parent widget, not the tkSimpleDialog.Dialog?

Re: cut & paste text between tkinter widgets

2005-08-04 Thread William Gill
handy. Thanks, Bill [EMAIL PROTECTED] wrote: > Here's some code that gives a cut-copy-paste pop-up window on all Entry > widgets > in an application. > > This code is released into the public domain. > > Jeff Epler > # >

Re: cut & paste text between tkinter widgets

2005-08-03 Thread William Gill
>> Is there a simple way to cut and paste from a tkinter text widget to >> an entry widget? I know I could create a mouse button event that >> triggers a popup (message widget) prompting for cut/paste in each of >> the widgets using a temp variable to hold the text, but I don't wnat >> to re

cut & paste text between tkinter widgets

2005-08-03 Thread William Gill
Is there a simple way to cut and paste from a tkinter text widget to an entry widget? I know I could create a mouse button event that triggers a popup (message widget) prompting for cut/paste in each of the widgets using a temp variable to hold the text, but I don't wnat to reinvent the wheel

Re: main window in tkinter app

2005-07-20 Thread William Gill
ometing in baseclass.__init() not taking place, but the recursion loop didn't give me a clue. Any idea why failing to init the base class caused the loop? Bill Christopher Subich wrote: > William Gill wrote: > >> O.K. I tried from scratch, and the following snippet produces

Re: main window in tkinter app

2005-07-19 Thread William Gill
It also seems to operate the same with or without " app.mainloop()". Is an explicit call to mainloop needed? William Gill wrote: > O.K. I tried from scratch, and the following snippet produces an > infinite loop saying: > > File "C:\Python24\lib\lib-tk\Tkinter.py&

Re: main window in tkinter app

2005-07-19 Thread William Gill
lf.var ('1') import os from Tkinter import * class MyApp(Tk): var=1 def __init__(self): pass def getval(self): return self.var app = MyApp() app.title("An App") print app.getval() app.mainloop() Eric Brunel wrote: > On Mon, 18 Jul 2005 16:57:51 GM

Re: main window in tkinter app

2005-07-19 Thread William Gill
repeat of the original problem I will post the code and the exact error message, but at least now I know It SHOULD work. Thanks Bill, Eric Brunel wrote: > On Mon, 18 Jul 2005 16:57:51 GMT, William Gill <[EMAIL PROTECTED]> wrote: > >> A short while ago someone posted that(unl

main window in tkinter app

2005-07-18 Thread William Gill
A short while ago someone posted that(unlike the examples) you should use Tk as the base for your main window in tkinter apps, not Frame. Thus : class MyMain(Frame): def __init__(self, master): self.root = master self.master=master self

Re: Tkinter grid layout

2005-07-06 Thread William Gill
Excuse me for intruding, but I followed examples and ended up with a similar architecture: from Tkinter import * class MyMain(Frame): def __init__(self, master): self.root = master self.master=master root = Tk() app = MyMain(root) app.ma

Re: tkinter radiobutton

2005-06-29 Thread William Gill
initialize as no choice ... will be clearer. Thanks again! Bill Peter Otten wrote: > William Gill wrote: > > >>Also, does 'row == var.get() for var in self.variables' perform the >>comparison row == var.get() for each item in self.variables? I would >>have h

Re: tkinter radiobutton

2005-06-28 Thread William Gill
Radiogrid doesn't initialize w/row 1 selected, and accomodates cases where nothing is selected in any column. Bill Peter Otten wrote: > William Gill wrote: > > >>I thought the problem was practical, not philosophical, but what do I >>know I'm the one asking for help.

Re: tkinter radiobutton

2005-06-28 Thread William Gill
or var in self.variables' perform the comparison row == var.get() for each item in self.variables? I would have had to write: for var in self.variables: return row == var.get() Again, thanks. Bill Peter Otten wrote: > William Gill wrote: > > >>I thought the problem w

Re: tkinter radiobutton

2005-06-28 Thread William Gill
e column information (intVar values) to row information. Bill Peter Otten wrote: > William Gill wrote: > > >>The radiobutton widget knows if it is selected or unselected, or it >>wouldn't be able to display correctly, but based on what I'm seeing, >>that

Re: tkinter radiobutton

2005-06-28 Thread William Gill
different intVar to each 'column', but I can't figure out how to 'slice' them horizontally w/o breaking their vertical relationships. Bill Peter Otten wrote: > William Gill wrote: > > >>I am placing radiobuttons in a 4 X 4 matrix (using loops) and kee

Re: tkinter radiobutton

2005-06-27 Thread William Gill
d have to loop through all four intVars four times to determine which radiobuttons are selected in each row. That's what I mean by messy. Bill Eric Brunel wrote: > On Sat, 25 Jun 2005 19:34:50 GMT, William Gill <[EMAIL PROTECTED]> wrote: > >> I am placing radiob

tkinter radiobutton

2005-06-25 Thread William Gill
I am placing radiobuttons in a 4 X 4 matrix (using loops) and keep references to them in a 2 dimensional list ( rBtns[r][c] ). It works fine, and I can even make it so only one button per column can be selected, by assigning each column to an intVar. In many languages a radiobutton has a prop

pass an event up to parent widget

2005-06-23 Thread William Gill
I have a Tkinter (frame) widget that contains several other frame widgets, each containing entry widgets. In the parent frame I have a 'save' button that is initially disabled. As it is now, each widget has a hasChanged property that I can poll to see if updates to the source data need to be

Re: a comprehensive Tkinter document?

2005-06-22 Thread William Gill
Kent Johnson wrote: > William Gill wrote: > >> I know a major problem I am having is that I am finding lots of >> Tkinter information in 'fragments' of various , sometimes conflicting >> vintages. For example the python reference I was using didn't sho

a comprehensive Tkinter document?

2005-06-22 Thread William Gill
I know a major problem I am having is that I am finding lots of Tkinter information in 'fragments' of various , sometimes conflicting vintages. For example the python reference I was using didn't show the '%%' as an escape sequence, I posted asking how to escape the '%' and after several help

'custom' events ?

2005-06-22 Thread William Gill
I am trying to create a Python UI in Tkinter and have several (frame) widgets that display various data fields. I am trying to create a 'changed' event that each widget can trigger when they have been edited. I see lots of references that suggest that 'custom' events can be created, but have

Re: access properties of parent widget in Tkinter

2005-06-16 Thread William Gill
Kent Johnson wrote: > William Gill wrote: > >> Kent Johnson wrote: >> >> If I change the area code in one record only the phonenumber table >> needs to be updated, but since areaCode is a child of phones, >> phones.hasChanged needs to be set to True by th

Re: access properties of parent widget in Tkinter

2005-06-16 Thread William Gill
Kent Johnson wrote: > William Gill wrote: > >> I am trying to get & set the properties of a widget's parent widget. >> What I have works, but seems like a long way around the block. First >> I get the widget name using w.winfo_parent(), then i convert

Re: access properties of parent widget in Tkinter

2005-06-16 Thread William Gill
Kent Johnson wrote: > William Gill wrote: > >> I am trying to get & set the properties of a widget's parent widget. >> What I have works, but seems like a long way around the block. First >> I get the widget name using w.winfo_parent(), then i convert

Re: access properties of parent widget in Tkinter

2005-06-16 Thread William Gill
Kent Johnson wrote: > William Gill wrote: > >> I am trying to get & set the properties of a widget's parent widget. >> What I have works, but seems like a long way around the block. First >> I get the widget name using w.winfo_parent(), then i convert

access properties of parent widget in Tkinter

2005-06-15 Thread William Gill
I am trying to get & set the properties of a widget's parent widget. What I have works, but seems like a long way around the block. First I get the widget name using w.winfo_parent(), then i convert the name to a reference using nametowidget(). self.nametowidget(event.widget.winfo_parent())

Re: string formatting using the % operator

2005-06-13 Thread William Gill
Dan Sommers wrote: > On Mon, 13 Jun 2005 15:12:54 GMT, > William Gill <[EMAIL PROTECTED]> wrote: > > >>I am using the % operator to create queries for a db app. It works fine >>when exact strings, or numbers are used, but some queries need partial >>matching

string formatting using the % operator

2005-06-13 Thread William Gill
I am using the % operator to create queries for a db app. It works fine when exact strings, or numbers are used, but some queries need partial matching that use the '%' as a wildcards. So for example the resultant string should be 'WHERE name LIKE %smith%' (would match silversmith, smithy, an

Re: Capture close window button in Tkinter

2005-06-12 Thread William Gill
Jonathan Ellis wrote: > William Gill wrote: > >>I am trying to make a simple data editor in Tkinter where each data >>element has a corresponding Entry widget. I have tried to use the >>FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has

Capture close window button in Tkinter

2005-06-12 Thread William Gill
I am trying to make a simple data editor in Tkinter where each data element has a corresponding Entry widget. I have tried to use the FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not changed, the db doesn’t need updating). This seems to work fine except that when the