[Tutor] Time module

2007-12-04 Thread Norman Khine
Hello, I am having difficulties in converting the following to display the difference that has passed in hours and seconds in a nice way. from datetime import datetime now = datetime.now() posted = date difference = now - posted namespace['date'] = date namespace['posted'] = difference when I l

[Tutor] Tkinter Canvas Saving and Opening

2007-12-04 Thread Johnston Jiaa
I know that Tkinter's canvas can output its contents into a postscript file, but can that file be used in turn to restore the image? How can I implement this file-saving and opening feature? ___ Tutor maillist - Tutor@python.org http://mail.python.

[Tutor] [Fwd: Re: Button 1 Motion Event]

2007-12-04 Thread Luke Paireepinart
Johnston, please reply on-list. You have to either use "reply-all" or type "tutor@python.org" as a recipient, because messages aren't sent to tutor@python.org by default when you click "reply". Thanks, -Luke --- Begin Message --- That being said, you should still post your code, because there

Re: [Tutor] Button 1 Motion Event

2007-12-04 Thread Tiger12506
>From your description, it sounds like the number of ovals placed depends only on when the B1-Motion even is sent to your Canvas object. If you want these a little more even, you might take the drawing code out of the function that's bound to the mouse event, so that whenever you process you a

Re: [Tutor] Button 1 Motion Event

2007-12-04 Thread Luke Paireepinart
Johnston Jiaa wrote: > I'm creating a drawing program, like MS Paint in Tkinter. I bound > the event to my Canvas object. The function it's bound > to creates an oval at the event's x and y attributes. > > This works fine if the user is dragging slowly, but if he does a > sudden dragging m

Re: [Tutor] Button 1 Motion Event

2007-12-04 Thread Alan Gauld
"Johnston Jiaa" <[EMAIL PROTECTED]> wrote > I'm creating a drawing program, like MS Paint in Tkinter. I bound > the event to my Canvas object. The function it's bound > to creates an oval at the event's x and y attributes. > > This works fine if the user is dragging slowly, but if he does a >

[Tutor] Button 1 Motion Event

2007-12-04 Thread Johnston Jiaa
I'm creating a drawing program, like MS Paint in Tkinter. I bound the event to my Canvas object. The function it's bound to creates an oval at the event's x and y attributes. This works fine if the user is dragging slowly, but if he does a sudden dragging motion, the ovals are very far ap

[Tutor] Thanks (was Random Number Generator)

2007-12-04 Thread earlylight publishing
Thank you everyone for your help! I have no idea why it never occured to me to Google it. Thanks for the code. Now let's see if I can get this sucker to work! - Looking for last minute shopping deals? Find them fast with Yahoo! Search.

Re: [Tutor] Random Number Generator

2007-12-04 Thread bhaaluu
On Dec 4, 2007 2:29 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "bhaaluu" <[EMAIL PROTECTED]> wrote > > > You can use Python itself for getting help: > > > help('random') > > Well, well. I've been busily importing everything I wanted help on, > not realising I could just quote it! > > Now that

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-04 Thread Ricardo Aráoz
Eric Brunson wrote: > Ricardo Aráoz wrote: >> Danny Yoo wrote: >> Hello: I'm seeing some strange behavior with lstrip operating on string representations of *nix-style file paths Example: >>> s = '/home/test/' >>> s1 = s.lstrip('/home') >>> s1 >>>

Re: [Tutor] Selecting a browser

2007-12-04 Thread Ricardo Aráoz
Tim Golden wrote: > Ricardo Aráoz wrote: >> These guys have given their free time so that we can enjoy their module, > > hey could have no documentation at all... > > That said, my comments about documentation lacking still stand. > > I think the important thing here is that "these guys" is you

Re: [Tutor] Time module

2007-12-04 Thread Kent Johnson
Norman Khine wrote: > Hello, > I am having difficulties in converting the following to display the > difference that has passed in hours and seconds in a nice way. > > from datetime import datetime > now = datetime.now() > posted = date > difference = now - posted > > namespace['date'] = date >

[Tutor] Time module

2007-12-04 Thread Norman Khine
Hello, I am having difficulties in converting the following to display the difference that has passed in hours and seconds in a nice way. from datetime import datetime now = datetime.now() posted = date difference = now - posted namespace['date'] = date namespace['posted'] = difference when I l

Re: [Tutor] Random Number Generator

2007-12-04 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > You can use Python itself for getting help: > help('random') Well, well. I've been busily importing everything I wanted help on, not realising I could just quote it! Now that little insight has probably saved me an hour a year or more! Thanks for t

Re: [Tutor] Random Number Generator

2007-12-04 Thread bhaaluu
Greetings, Take a look at my first Python program for an example: http://www.geocities.com/ek.bhaaluu/python/paperock.py.txt That should give you an idea. Also: You can use Python itself for getting help: >>> help('random') Happy Programming! -- b h a a l u u at g m a i l dot c o m http://www.

Re: [Tutor] Random Number Generator

2007-12-04 Thread Jason Massey
Easy enough. You'll want to import the random module and use the functions in it. Also, http://docs.python.org/lib/lib.html is going to be your best friend. You'll notice on that page among many other things is a section on random number generation. As to your code: >>>import random >>>a = ran

[Tutor] Random Number Generator

2007-12-04 Thread earlylight publishing
Hello All, I'm a bare beginner to python (or indeed) any programming. I'm helping myself become more proficient by making a text adventure game. The problem is I need a function (or module) that will generate a random number within a range, say 1-20 for example. The ability to program t

Re: [Tutor] Selecting a browser

2007-12-04 Thread Doug Hellmann
+1 On Dec 4, 2007, at 10:36 AM, Andre Roberge wrote: Forwarded to the ghop-discussion list :-) Thanks Kent for the suggestion. André On Dec 4, 2007 11:13 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: Tim Golden wrote: > In addition, for those not following that particular > story, the Google H

Re: [Tutor] Selecting a browser

2007-12-04 Thread Andre Roberge
Forwarded to the ghop-discussion list :-) Thanks Kent for the suggestion. André On Dec 4, 2007 11:13 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Tim Golden wrote: > > In addition, for those not following that particular > > story, the Google Highly Open thingy (GHOP) is seeing > > a bunch of

Re: [Tutor] Selecting a browser

2007-12-04 Thread Kent Johnson
Tim Golden wrote: > In addition, for those not following that particular > story, the Google Highly Open thingy (GHOP) is seeing > a bunch of updates, additions and corrections to the > docs being submitted pretty much every day. Which can > only be a good thing! In fact updating the webbrowser do

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Kent Johnson wrote: > Ricardo Aráoz wrote: >> Tim Golden wrote: >>> Agreed. But it would be more constructive to offer a simple >>> patch to the webbrowser docs. > > You don't even need to give a formal patch. Just write the doc change in > plain text and submit it as a bug. True. But the entry

Re: [Tutor] Selecting a browser

2007-12-04 Thread Kent Johnson
Ricardo Aráoz wrote: > Tim Golden wrote: >> Agreed. But it would be more constructive to offer a simple >> patch to the webbrowser docs. You don't even need to give a formal patch. Just write the doc change in plain text and submit it as a bug. > Ok, I took a look. Nice link to know [1], I've ad

Re: [Tutor] Selecting a browser

2007-12-04 Thread Kent Johnson
Ricardo Aráoz wrote: > Thanks Kent, that was certainly the problem. So I went through it just > to hit another wall, when issuing the open method : > ff.open('http://www.google.com') > Traceback (most recent call last): > File "", line 1, in > File "E:\Python25\lib\webbrowser.py", line 1

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Ricardo Aráoz wrote: > Tim Golden wrote: >> Ricardo Aráoz wrote: >>> Martin Walsh wrote: And by the way, the '&' has special meaning to the webbrowser.get method -- it determines whether a BackgroundBrowser or GenericBrowser object is returned. >>> LOL, another demerit to documentati

Re: [Tutor] Selecting a browser

2007-12-04 Thread Ricardo Aráoz
Tim Golden wrote: > Ricardo Aráoz wrote: >> Martin Walsh wrote: >>> And by the way, the '&' has special meaning >>> to the webbrowser.get method -- it determines whether a >>> BackgroundBrowser or GenericBrowser object is returned. >> LOL, another demerit to documentation. > > Agreed. But it would

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Ricardo Aráoz wrote: > These guys have given their free time so that we can enjoy their module, > hey could have no documentation at all... > That said, my comments about documentation lacking still stand. I think the important thing here is that "these guys" is you and me. Documentation is exa

Re: [Tutor] Selecting a browser

2007-12-04 Thread Ricardo Aráoz
Tim Golden wrote: > Ricardo Aráoz wrote: >> Martin Walsh wrote: >>> And by the way, the '&' has special meaning >>> to the webbrowser.get method -- it determines whether a >>> BackgroundBrowser or GenericBrowser object is returned. >> LOL, another demerit to documentation. > > Agreed. But it would

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Ricardo Aráoz wrote: > Martin Walsh wrote: >> And by the way, the '&' has special meaning >> to the webbrowser.get method -- it determines whether a >> BackgroundBrowser or GenericBrowser object is returned. > > LOL, another demerit to documentation. Agreed. But it would be more constructive to o