Re: [Tutor] AttributeError: 'str' object has no attribute 'geturl'

2005-10-10 Thread Javier Ruere
Joseph Quigley wrote: > Ok, new version (sorry to bug you). > This time I've edited the program so that you can only download todays > (it won't work for any other date). Now I can connect to the server but > it sticks on "Downloading image!" > > Thanks for your prevoius help. > Joe You are w

Re: [Tutor] Regex help

2005-10-10 Thread Bill Burns
> On Mon, 10 Oct 2005, Bill Burns wrote: > > >>I'm looking to get the size (width, length) of a PDF file. > > Hi Bill, > > Just as a side note: you may want to look into using the 'pdfinfo' utility > that comes as part of the xpdf package: > > http://www.foolabs.com/xpdf/ > > For exampl

Re: [Tutor] code improvement for beginner ?

2005-10-10 Thread Danny Yoo
> > The point of this restructuring is to allow you to add more image > > types without too much pain, since there's no more hardcoded array > > indexing against r1. It also simplifies to calls to imgreg from: > > > > if imgreg(r1[0],a) == 1: > > continue > > if imgreg(r1[1],a) =

Re: [Tutor] Tutor Digest, Vol 20, Issue 37

2005-10-10 Thread John Fouhy
On 11/10/05, Joseph Quigley <[EMAIL PROTECTED]> wrote: > I think I should mention that I'm completely in the dark when it comes > to GUI programming (and I don't have much time to learn it... or do I?) You're likely to have more success with your programming if you do learn what you're doing :-)

Re: [Tutor] Tutor Digest, Vol 20, Issue 37

2005-10-10 Thread Joseph Quigley
Michael Wrote: >Hi Joe, > >the image won't refresh until you explicitely tell Tk to do so, so you would >have to do some more >in newPic(); btw, it looks overly complicated to me to use a "Data" class >where a simple variable >will do the trick, so I would suggest to change the code like this: >

Re: [Tutor] Please look at my wordFrequency.py

2005-10-10 Thread Danny Yoo
> 3) No modularization. Couldn't see a reason to do so. Is there one or > two? Specifically, what sections should become modules, if any? Hi Dick, My recommendation is to practice using and writing functions. For example, this block here is a good candidate to box off as a named function: ###

Re: [Tutor] Please look at my wordFrequency.py

2005-10-10 Thread Kent Johnson
Dick Moores wrote: > Specifically, I'm hoping for comments on or help with: > 1) How to debug. I'm using v2.4, IDLE on Win XP. I have been using winpdb recently, it is a pretty decent standalone Python debugger for Windows. Start it with the -t switch so you don't need the Python Cryptographic

Re: [Tutor] Please look at my wordFrequency.py

2005-10-10 Thread Alan Gauld
> Has anyone else experienced this? I tried debugging in IDLE with the > source checkbox enabled, but when the sourcecode window lost focus as > I clicked back on the debugger window to hit the step button, the > highlight indicating the current line of source was no longer visible. > It's probably

Re: [Tutor] Please look at my wordFrequency.py

2005-10-10 Thread John Fouhy
On 11/10/05, Dick Moores <[EMAIL PROTECTED]> wrote: > I worked on this a LONG time for something I expected to just be an easy > and possibly useful exercise. Three times I started completely over with > a new approach. Had a lot of trouble removing exactly the characters I > didn't want to appear

Re: [Tutor] Regex help

2005-10-10 Thread Danny Yoo
On Mon, 10 Oct 2005, Bill Burns wrote: > I'm looking to get the size (width, length) of a PDF file. Hi Bill, Just as a side note: you may want to look into using the 'pdfinfo' utility that comes as part of the xpdf package: http://www.foolabs.com/xpdf/ For example:

Re: [Tutor] Please look at my wordFrequency.py

2005-10-10 Thread R. Alan Monroe
> IDLE's debugger isn't pretty but it does work, try it. > Use the context menus and mouse to set a break point, > then just step through using the step and next buttons. Has anyone else experienced this? I tried debugging in IDLE with the source checkbox enabled, but when the sourcecode window lo

Re: [Tutor] handling of tabular data

2005-10-10 Thread Alan Gauld
> overhead for me to store the data persistently, because then I would > have to manage updates to individual rows and columns right now, I > simply construct the latest version of my data table from my source > data, whenever the script is run this is also the reason why I am using > python in the

[Tutor] Undocumented 't' mode flag for open() [Was: Re: code improvement for beginner ?]

2005-10-10 Thread Danny Yoo
On Sun, 9 Oct 2005, Roel Schroeven wrote: > Danny Yoo wrote: > > Looking at pageimgs(): I'm not sure what 't' means in the open statement: > > > > f = open(filename, "rt") > > > > and I think that 't' might be a typo: I'm surprised that Python doesn't > > complain. Can anyone confirm this?

Re: [Tutor] Please look at my wordFrequency.py

2005-10-10 Thread Alan Gauld
> didn't want to appear in the output. Wished I knew how to debug other than > just by using a lot of print statements. When you need to get to the nitty gritty you need to use a realdebugger. The best GUI one is probably the one in Pythonwin. The standard one is PDB and the tutorial on it is OK

Re: [Tutor] code improvement for beginner ?

2005-10-10 Thread Kent Johnson
Roel Schroeven wrote: > Danny Yoo wrote: > >>Looking at pageimgs(): I'm not sure what 't' means in the open statement: >> >> f = open(filename, "rt") > > It's not a typo. 't' opens the file in text mode. Are you sure? Is that documented anywhere? Text mode is the default, you have to spec

Re: [Tutor] New image with Tkinter?

2005-10-10 Thread Alan Gauld
def newPic(): Data.pic += 1 def Dsp_Image(): .. imgPrep = ImageTk.PhotoImage(img) imgShow = Label(app, image=imgPrep).grid() ... next = Button(app, text="Next Image", command=newPic).grid() app.mainloop() Dsp_Image() > The image won't refresh when I click on 'Next'! > A

Re: [Tutor] New image with Tkinter?

2005-10-10 Thread Michael Lange
On Mon, 10 Oct 2005 11:36:22 -0600 Joseph Quigley <[EMAIL PROTECTED]> wrote: > Hi, > I've written an image reader that uses the PIL module. > I have a variable that uses os.listdir('mydir') to make a list of all the > pictures in the folder... here's what I'm talking about: (...) > The image won't

Re: [Tutor] handling of tabular data

2005-10-10 Thread Danny Yoo
On Sun, 9 Oct 2005, [ISO-8859-1] Frank Hoffs�mmer wrote: > thanks for your answers looks like SQL is the ticket for such > problems... because my data is updated quite often, it feels like an > overhead for me to store the data persistently, because then I would > have to manage updates to indiv

Re: [Tutor] Listing all of an instances variables

2005-10-10 Thread Kent Johnson
Matt Williams wrote: > Dear List, > > I'm stuck on trying to write a generic 'report' function: > > Class SomeClass: >def __init__(self,a,b): > self.a = a > self.b = b > >def report(self): > for i in dir(self): > print self.i > > > > > This is where I run

[Tutor] Please look at my wordFrequency.py

2005-10-10 Thread Dick Moores
Script is at: Example text file for input: (142 kb) (from ) Example output in file:

Re: [Tutor] code improvement for beginner ?

2005-10-10 Thread lmac
Danny Yoo wrote: > > On Sat, 8 Oct 2005, lmac wrote: > > >>Ok. Here we go. Wanted to start my page long ago. Now is the right time. >> >>http://daderoid.freewebspace24.de/python/python1.html > > > Hi lmac, > > I'll pick out some stuff that I see; I'm sure others will be happy to give > commen

Re: [Tutor] is there any Python code for spatial tessellation?

2005-10-10 Thread Danny Yoo
On Sun, 9 Oct 2005, Shi Mu wrote: > There are four points with coordinates: > 2,3;4,9;1,6;3,10. > How to use Python to draw one perpendicular bisector between (2,3) and (4,9); > the other perpendicular bisector between (1,6)$BOB(B(3,10); > then, makes the output like: > l1 a b c > l2 a b c > (

Re: [Tutor] Stopping function after given time

2005-10-10 Thread Oliver Maunder
>Simple question: Is it possible to stop a running function after certain>predefined time? >>I would like to convert this routine to Python using pycurl module, or maybe>even standard urllib.urlretrieve. If you use urllib.urlretrieve, you can pass in a callback function that gets called after eve

[Tutor] New image with Tkinter?

2005-10-10 Thread Joseph Quigley
Hi, I've written an image reader that uses the PIL module. I have a variable that uses os.listdir('mydir') to make a list of all the pictures in the folder... here's what I'm talking about: pics = os.listdir(imgDir) pics.remove('license.txt') pics.remove('gacor.py') class Data:     pic = 0 print "

Re: [Tutor] and-or precedence

2005-10-10 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-10-10 at 17:58 +0530, Krishna wrote: > >>> 1 or 2 and 3 > 1 > > Why does the above expression return 1? As per my understanding of > boolean operations, this is what should have happaned: > > 1 or 2 => 1 and then > 1 and 3 => 3 > > The library reference also suggests that 'or' has h

Re: [Tutor] Stopping function after given time

2005-10-10 Thread Johan Geldenhuys
You can use the Timer in threading. Look at what is done in the attached script. You can basically use three functions to start the timer, stop the timer and do what ever it is to be done upon expiring. There maybe easier ways, but this will work. You can call the start_timer with a time in se

Re: [Tutor] line question

2005-10-10 Thread Daniel Watkins
> There are four points with coordinates: > 2,3;4,9;1,6;3,10. > How to use Python to draw one perpendicular bisector between (2,3) and > (4,9); > the other perpendicular bisector between (1,6)和(3,10); > then, makes the output like: > l1 a b c > l2 a b c > (Note: l indicates the perpendicular

[Tutor] Stopping function after given time

2005-10-10 Thread Raduz
Hi all Simple question: Is it possible to stop a running function after certain predefined time? Right now I have some home-made bash scripts for recording shows from net broadcasted ogg stream, that use wget for stream downloading, and two "at" jobs - one for first script (which prepares dire

Re: [Tutor] and-or precedence

2005-10-10 Thread paul brian
has a higher priority than (as shown on the page you referenced -its "ascending priority"). Perhaps that could be clearer. I find that brackets always make life easier in these cases (a rare statement in the Python world :-), and on a personal note I would always always comment heavily boolean o

[Tutor] and-or precedence

2005-10-10 Thread Krishna
>>> 1 or 2 and 3 1 Why does the above expression return 1? As per my understanding of boolean operations, this is what should have happaned: 1 or 2 => 1 and then 1 and 3 => 3 The library reference also suggests that 'or' has higher priority than 'and'. http://docs.python.org/lib/boolean.html Th

Re: [Tutor] Regex help

2005-10-10 Thread Bill Burns
[Andrew] > If the format is consistent enough, you might get away with something like: > > >>> p = re.compile('MediaBox \[ ?\d+ \d+ (\d+) (\d+) ?\]') > >>> print p.search(s).groups() > ('612', '792') > > The important bits being: ? means "0 or 1 occurences", and you can use > parentheses to

Re: [Tutor] line question

2005-10-10 Thread Alan Gauld
Hi, Can you describe how you would solve the problem without Python first of all? Just so we understand what you want to do and how much is a Python problem and how much a basic understanding issue. Often once you think through how to do it without Python the programming becomes easier. Alan G Au

Re: [Tutor] Regex help

2005-10-10 Thread Bill Burns
>> I'm looking to get the size (width, length) of a PDF file. Every pdf >> file has a 'tag' (in the file) that looks similar to this >> >> Example #1 >> MediaBox [0 0 612 792] >> >> or this >> >> Example #2 >> MediaBox [ 0 0 612 792 ] >> >> I figured a regex might be a good way to get this data but

Re: [Tutor] is there any Python code for spatial tessellation?

2005-10-10 Thread Duncan Gibson
This is off-topic for Python: I've seen this on the FLTK mailing list, but you might find some of the links under this page useful: http://myweb.tiscali.co.uk/oaktree/nshea/tesselsphere/tesselsphere_index.html "OpenGL spherical subdivision utility. Currently employs particle and geodesic mod

Re: [Tutor] is there any Python code for spatial tessellation?

2005-10-10 Thread János Juhász
Dear Danny, take a look to http://public.kitware.com/VTK/ I have seen visualization for voronoi and delaunay in that package. I have seen also good programming samples mainly in C for calculating perpedincular and so on at: