Re: [Tutor] [webbrowser] some help on an error running mozilla firefox

2006-01-23 Thread Henry Finucane
On 1/22/06, Rinzwind <[EMAIL PROTECTED]> wrote:
> Why does this:
>
>  >>> import webbrowser
>  >>> webbrowser.open('http://www.google.com";)
>
> give me this:
>
>  run-mozilla.sh: Cannot execute
> /opt/firefox/mozilla-firefox-bin.
>

I would assume it's a permissions error. Can you execute
/opt/firefox/mozilla-firefox-bin? Is python running as a different
user?

--
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tkinter pass-by-reference query

2006-05-19 Thread Henry Finucane
While attempting to add images to a canvas programmatically, I wrote
the following:
for i in os.listdir('./icons/terrain'):
self.terrainScreen["height"] = str(int(self.terrainScreen["height"])+50)
debug(self.terrainScreen["height"]+" height of terrainScreen",5)
img = PhotoImage(file='./icons/terrain/'+i)

self.terrainScreen.create_image(int(self.terrainScreen["height"])-50,(int(self.terrainScreen["height"])-50),
image=img,tag=None)

I couldn't figure out why it didn't work, until I went in and played
with Tkinter in the python shell, and I came to the conclusion that
the reason nothing was displayed on the canvas was that images are
passed by reference. In other words, unless there is a permanent `img'
variable, the data disappears.

For example (replace w\ your own gifs):
>>> from Tkinter import *
>>> root = Tk()
>>> terrain = Canvas(root,width=50,height=50)
>>> img = PhotoImage(file='MapEditor/icons/terrain/desert.gif')
>>> terrain.create_image(0,0,image=img)
1
>>> terrain.pack()

Works beautifully, eh?

>>> img = PhotoImage(file='MapEditor/icons/terrain/water.gif')

Doh! Now it disappears!

>>> terrain.create_image(0,50,image=img)
2

Working, but there is only one image

>>> terrain.create_image(0,0,image=PhotoImage('MapEditor/icons/terrain/grass.gif'))
3

Nothing gets displayed.

So there is my problem, and what is, I'm fairly certain, the cause of
the problem. Unfortunately, I really have no idea what the proper
solution should be. I'd like to populate the canvas programmatically,
but my brain seems to be choking on possible solutions. Suggestions?
Can I force variables to be passed by value?

-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Please help!!

2006-05-19 Thread Henry Finucane
On 5/19/06, MATATA EMMANUEL <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi there,
Hi!
>
> I'm tasked to write a Paython script which is supposed to hit a web site and
> download a shapefile from that web site.

Cool. Look at urllib in your python documentation.

> I don't have any clue and

Me neither :)

> would like your help. I use 9.x if this matter.

9.x what? Python has yet to release 2.6, if I'm not mistaken.

>
> Thank you.
>
> Matt.

Good luck.

>
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>


-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tkinter pass-by-reference query

2006-05-20 Thread Henry Finucane
Thanks for your help, I've gotten it to work.

On 5/20/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> > While attempting to add images to a canvas programmatically, I wrote
> > the following:
> > for i in os.listdir('./icons/terrain'):
> > ...  img = PhotoImage(file='./icons/terrain/'+i)
> > self.terrainScreen.create_image(int(self.terrainScreen["height"])-50,
> >
> > (int(self.terrainScreen["height"])-50),
> >  image=img,tag=None)
>
> > with Tkinter in the python shell, and I came to the conclusion that
> > the reason nothing was displayed on the canvas was that images are
> > passed by reference.
>
> Everything in Python is passed by reference. The issue here is that
> one the reference goes out of scope the image object gets garbage
> collected!
>
> > In other words, unless there is a permanent `img' variable, the data
> > disappears.
>
> >For example (replace w\ your own gifs):
> >>> from Tkinter import *
> >>> root = Tk()
> >>> terrain = Canvas(root,width=50,height=50)
> >>> img = PhotoImage(file='MapEditor/icons/terrain/desert.gif')
> >>> terrain.create_image(0,0,image=img)
>
> >Works beautifully, eh?
>
> >>> img = PhotoImage(file='MapEditor/icons/terrain/water.gif')
>
> > Doh! Now it disappears!
>
> You've crated a new image object but you need to pass that to
> the canvas, or more easily...
> Try configuring the file property of the image:
>
> img.configure(file='MapEditor/icons/terrain/water.gif')
>
> That changes the file used by the image object that is being
> displayed.
>
> The image object is a placeholder within your GUI for displaying
> graphics. You only need one object because you are onmly displaying
> one image (at a time) in the GUI.
>
> HTH,
>
> Alan Gauld
> Author of the Learn to Program web site
> http://www.freenetpages.co.uk/hp/alan.gauld
>
>
>


-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] File like object for Windows registry

2006-08-03 Thread Henry Finucane
On 8/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello!
>
> My app should run on debian and windows platforms. For storing the 
> configuration data, I use the ConfigParser module.
>
> What I find difficult is to determine a place for my configuration file. On 
> debian, it is simply
>
> os.path.join(os.path.expanduser("~")),"myconfig")
>
> but what am I supposed to do on Windows? I think a clean solution would be to 
> create a file-like object that reads and writes to the registry, is it?

You might be able to do that, I don't know much about win32
programming, but I believe a better solution is to use the built-in
windows variables. %APPDATA% is where you should store user-specific
application data (and even Microsoft is starting to store XML
configuration files there), and it's an easy variable to get.

>>> import os
>>> os.environ["APPDATA"]
'C:\\Documents and Settings\\UserName\\Application Data'

That should function just fine as a home directory replacement.

> Kind regards,
> Karsten.
> --
>
>
> "Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>


-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] File like object for Windows registry

2006-08-03 Thread Henry Finucane
On 8/3/06, Andre Roberge <[EMAIL PROTECTED]> wrote:
> On 8/3/06, Henry Finucane <[EMAIL PROTECTED]> wrote:
> > On 8/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > Hello!
> > >
> > > My app should run on debian and windows platforms. For storing the 
> > > configuration data, I use the ConfigParser module.
> > >
> > > What I find difficult is to determine a place for my configuration file. 
> > > On debian, it is simply
> > >
> > > os.path.join(os.path.expanduser("~")),"myconfig")
>
> This works on Windows as well.  I just tried it :-)

Doh. Always try the simple stuff first :P.

> > >
> > > but what am I supposed to do on Windows? I think a clean solution would 
> > > be to create a file-like object that reads and writes to the registry, is 
> > > it?
>
> Messing with the registry is (imo)  a bad idea.
>
> >
> > You might be able to do that, I don't know much about win32
> > programming, but I believe a better solution is to use the built-in
> > windows variables. %APPDATA% is where you should store user-specific
> > application data (and even Microsoft is starting to store XML
> > configuration files there), and it's an easy variable to get.
> >
> > >>> import os
> > >>> os.environ["APPDATA"]
> > 'C:\\Documents and Settings\\UserName\\Application Data'
> >
> > That should function just fine as a home directory replacement.
> >
> ...
>
> André
>


-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Community documentation framework?

2006-08-07 Thread Henry Finucane
On 8/6/06, Bob Nienhuis <[EMAIL PROTECTED]> wrote:
>
>  Have you had the experience of finding a nifty bit of code on the
>  web, trying it out, and then discovering that technique
>  only worked in version X.YY, or requires module Z that
>  is no longer available?
>
>  Well perhaps we can address this situation.
>
>  I would like to see an online system that facilitates
>  the collaborative production, cataloging and updating of
>  community documentation. See an article, "Rethinking Community
>  Documentation" by Andy Oram
> .
>
>  Features I would like to see:
>  A Wikipedia-like capacity for community update-ability/modifiability
>  of documentation submissions.
>
>  Database for cataloging available packages, modules, FAQs, How-Tos
>  tutorials, cookbook code fragments etc. Should have capacity for
>  developers to add and others to add to their contributions.
>
>  Oram suggests a rating system for submissions so users can assess
>  the quality of submissions, and point to parts that need modification
>  or clarification..
>
>  Might use TurboGears, Django AJAX or other web framework?
>
>  I think main Python documentation is great, but there is a lot
>  of stuff out there that isn't documented so well, or needs
>  updating. This project is intended to adress that need.
>
>  What would you like to see?

Sounds neat. Personally, I would like to see a bit of consolidation in
ways you can look for help. There are oodles of web forums, the Tutor
mailing list, the comp.lang.python mailing list, tutorials scattered
all about the web, etc. Something like this could either prompt
consolidation (good), or simply create more fragmentation (not so
great, but acceptable).

It all depends on how it gets advertised.


>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>


-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tkinter Icon Suse 10

2006-08-27 Thread Henry Finucane
I found this mailing list message to be enlightening:
http://mail.python.org/pipermail/python-list/2005-March/273123.html
On 8/27/06, Alberto Troiano <[EMAIL PROTECTED]> wrote:
> I tried that but still the same error. Any other idea?
>
> Rgds,
>
> Alberto
>
>
> 2006/8/25, Alberto Troiano <[EMAIL PROTECTED] >:
> >
>
> Hi everyone
>
> It's been a long time since I left Python for .NET 2003, but then again I
> need it to make an app under Linux Suse 10 and I have a question
> I'm trying to put an icon to my window...
> Here is the code so far:
>
> ###Start Code###
>
> import Tkinter
> from Tkinter import *
>
> root = Tk()
> root.iconbitmap("Change.ico")
> root.mainloop()
>
> ###End Code###
>
> It works great under Windows but on an Suse 10 Machine it complains about
> the file. Is this because the icon files are not the same as in Windows or
> should I be using another sentence to make it work?
> I know it's a dumb question but I'm out of practice and I couldn't find docs
> on Google (maybe I didn't look where I supposed to)
> Ups..I forgot, I'm using Python 2.4.1
>
> Regards
> --
>  Alberto
>
>
>
> --
> Alberto Troiano
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>


-- 
--H.F.
My penguin is bigger than yours, mister...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor