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 Gillnore...@domain.invalid 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

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/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-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 Kellyian.g.ke...@gmail.com 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

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 this: http://docs.python.org

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

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 no

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 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 method

Re: Functions vs OOP

2011-09-03 Thread William Gill
On 9/3/2011 5:39 PM, Ben Finney wrote: William Gillnoreply@domain.invalid 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

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. --

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). Not all

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

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

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

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

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 use this

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
that I have re-thought the situation, but I do have several occasions where i need to view and select/deselect 50 or 60 options (checkbuttons). So this will make them much more manageable. Thanks, Bill On Thu, 01 Sep 2005 14:33:36 +0100, William Gill [EMAIL PROTECTED] wrote: I need

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

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 graphical

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

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

2005-08-31 Thread William Gill
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 graphical or flowcharting tool that they use to organize their class

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

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

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 textvariable option of several widgets. Effectively my

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()

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 textvariable option of several widgets. Effectively my

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 index can take a string, but what about looping through

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

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= 'select * from %s where cusid = %s ' % name,recID) Cursor.execute(sql

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 the module's paramstyle variable. mxODBC, for example, uses

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: help with mysql cursor.execute()

2005-08-14 Thread William Gill
, 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 Scott David Daniels wrote: William Gill wrote: I have been trying to pass

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: problem extending tkSimpleDialog.Dialog

2005-08-12 Thread William Gill
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, but am running into some (addressing) problems. My

Re: problem extending tkSimpleDialog.Dialog

2005-08-12 Thread William Gill
(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 have created a widget

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 # import

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: 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

Re: main window in tkinter app

2005-07-20 Thread William Gill
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 an infinite loop saying

Re: main window in tkinter app

2005-07-19 Thread William Gill
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(unlike the examples) you should use Tk as the base

Re: main window in tkinter app

2005-07-19 Thread William Gill
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 GMT, William Gill [EMAIL PROTECTED] wrote

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, line 1647, in __getattr__

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

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)

Re: tkinter radiobutton

2005-06-29 Thread William Gill
... 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 had to write: for var in self.variables: return row == var.get

Re: tkinter radiobutton

2005-06-28 Thread William Gill
', 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 keep references to them in a 2 dimensional list ( rBtns[r][c] ). It works fine, and I

Re: tkinter radiobutton

2005-06-28 Thread William Gill
(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 information is inaccessable to the app. Instead the app must

Re: tkinter radiobutton

2005-06-28 Thread William Gill
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 was practical, not philosophical, but what do I know I'm

Re: tkinter radiobutton

2005-06-28 Thread William Gill
that the 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. What follows looks more like a spec

Re: tkinter radiobutton

2005-06-27 Thread William Gill
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 radiobuttons in a 4 X 4 matrix (using loops) and keep references to them in a 2 dimensional list ( rBtns

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 show the '%%' as an escape sequence, I posted

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 the name to a reference using nametowidget

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 the name to a reference using nametowidget

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 the name to a reference using nametowidget

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 the areaCode entry widget. One possibility

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().

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,

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 that use the '%' as a wildcards. So for example

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 doesnt need updating). This seems to work fine except that when the

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 not changed, the db doesn't need updating