Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Alan Gauld

On 08/11/11 04:30, Nathaniel Trujillo wrote:

I just wrote the following GUI application. How do I get rid of the 7k
in the upper left hand corner and how to I put other stuff there like
say a picture of someone. Thanks for the help.


If you are using Windows I don't think you can, due to a bug in the 
underlying Tk libraries. If you are using Linux/MacOS then there is a 
function to replace the control icon.


I can't recall what it is, but its similar to the one used for setting 
the title text on the Window, one of the wm_x calls.


But you might get a better response asking on the Tkinter mailing list...

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 93, Issue 38

2011-11-08 Thread Rich Lovely

On 8 Nov 2011, at 02:45, tutor-requ...@python.org wrote:
> 
> Message: 4
> Date: Tue, 08 Nov 2011 11:26:31 +1100
> From: Steven D'Aprano 
> To: tutor@python.org
> Subject: Re: [Tutor] Single line webserver
> Message-ID: <4eb87737.8020...@pearwood.info>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Rich Lovely wrote:
>> Hi all, I was part of this list a couple of years ago, and a recent 
>> discussion at a python dojo brought to mind something I'd seen then:  a 
>> one-liner (potentially single statement) webserver.  I'm pretty sure it was 
>> posted to this list, but I can't find it in the archives, and a google 
>> search is similarly lacking in relevant results.
>> 
>> I was wondering if anyone (maybe the original author?) had a copy they could 
>> send me.
> 
> https://duckduckgo.com/html/?q=python%20one%2Dliner%20web%20server
> 
> Hits #2 #3 and #4 are:
> 
> http://tobyho.com/2010/04/26/one-liner-webserver-with/
> http://www.garyrobinson.net/2004/03/one_line_python.html
> http://aroberge.blogspot.com/2010/08/my-favourite-python-one-liner.html
> 
> 
> 
> -- 
> Steven

I'd like to draw your attention to my original message: "a google search is 
similarly lacking in relevant results."  Shouldn't it be clear from how easy it 
is to find SimpleHttp that it clearly /isn't/ what I'm looking for? Perhaps I 
should have mentioned that, but I thought I'd made it clear I'd tried a 
websearch.

The code I remember was a Socket-based webserver, written in one - albeit 
rather long - line.

Rich "RoadieRich" Lovely

There are 10 types of people in the world:
Those who know binary,
Those who do not,
And those who are off by one.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] tkfiledialogs and hidden files

2011-11-08 Thread Dave Angel

On 11/07/2011 09:45 PM, Jose Amoreira wrote:

Hello!
Is there any way to configure tkFileDialogs so that they don't display hidden
files?
Thanks.
Ze Amoreira


I can't help you with tk, but maybe I can help you ask a better question.

"Hidden files" means a different thing on various operating systems.  In 
Linux, it means a name with a leading period. In Windows, it can mean a 
file with one or more of several attributes.  There's even some 
ambiguity in the latter.


Please specify (to everyone else, not to me) what environment you're 
targeting in as much detail as possible.




--

DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] tkfiledialogs and hidden files

2011-11-08 Thread Jose Amoreira
On Tuesday, November 08, 2011 12:38:19 PM Dave Angel wrote:
> On 11/07/2011 09:45 PM, Jose Amoreira wrote:
> > Hello!
> > Is there any way to configure tkFileDialogs so that they don't display
> > hidden files?
> > Thanks.
> > Ze Amoreira
> 
> I can't help you with tk, but maybe I can help you ask a better question.
> 
> "Hidden files" means a different thing on various operating systems.  In
> Linux, it means a name with a leading period. In Windows, it can mean a
> file with one or more of several attributes.  There's even some
> ambiguity in the latter.
> 
> Please specify (to everyone else, not to me) what environment you're
> targeting in as much detail as possible.

Yes, I'm sorry.
I meant hidden files in Linux.
It's just that my home directory contains a lot of those files and directories 
and I'd rather not need to scroll the dialog display to get to the files/dirs 
that I usually want to select.
Anyway, thank s, Dave.
Ze Amoreira
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] tkfiledialogs and hidden files

2011-11-08 Thread Wayne Werner
On Tue, Nov 8, 2011 at 6:56 AM, Jose Amoreira  wrote:

> **
>
> On Tuesday, November 08, 2011 12:38:19 PM Dave Angel wrote:
>
> > On 11/07/2011 09:45 PM, Jose Amoreira wrote:
>
> > > Is there any way to configure tkFileDialogs so that they don't display
>
> > > hidden files?
>
 > "Hidden files" means a different thing on various operating systems. In
>
> > Linux, it means a name with a leading period. In Windows, it can mean a
>
> > file with one or more of several attributes. There's even some
>
> > ambiguity in the latter.
>
> >
>
> > Please specify (to everyone else, not to me) what environment you're
>
> > targeting in as much detail as possible.
>
>
> Yes, I'm sorry.
>
> I meant hidden files in Linux.
>
> It's just that my home directory contains a lot of those files and
> directories and I'd rather not need to scroll the dialog display to get to
> the files/dirs that I usually want to select.
>

If you know exactly what type of files you're looking for, or that it will
be in a specific set of extensions, you can at least get rid of the files
by specifying the filetypes=[(label1, extension1), (label2, extension2),
...] argument.

Other than that, it doesn't look possible to  hide the folders.
http://mail.python.org/pipermail/python-list/2003-April/199226.html

It's not the ideal solution, but you could probably roll your own (as
recommended in the referenced post) that gives you the ability to filter
based on filename (perhaps using a regex, or at least giving you the "^"
not character).

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Progress Bar

2011-11-08 Thread Nikunj Badjatya
Hi All,

 I am writing an installer in Python and Powershell which will be used to
install Virtual Machines at specific locations.
The main script is in Python and main.py inturn calls Powershell scripts
(.PS1).
It is complete console based and no gui.
I am using Python 2.7

 I was thinking to have a progress bar in my installer. similar to the way
when we install something in linux via console and a progress bar comes as

 "[# ] 40% "

 etc.

 I also saw and ran couple of examples based in Python on the net.
http://code.google.com/p/python-progressbar/source/browse/examples.py


 My question is, How do I integrate it with Powershell scripts.?

I am using popen() to run powershell scripts.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Steve Willoughby

On 08-Nov-11 00:39, Alan Gauld wrote:

On 08/11/11 04:30, Nathaniel Trujillo wrote:

I just wrote the following GUI application. How do I get rid of the 7k
in the upper left hand corner and how to I put other stuff there like
say a picture of someone. Thanks for the help.


If you are using Windows I don't think you can, due to a bug in the
underlying Tk libraries. If you are using Linux/MacOS then there is a
function to replace the control icon.

I can't recall what it is, but its similar to the one used for setting
the title text on the Window, one of the wm_x calls.

But you might get a better response asking on the Tkinter mailing list...



I have an app I'm developing and running successfully on Windows (as 
well as OSX and Linux).  At least in this case it is able to replace the 
application icon in place of the default "TK" one.  The code I use is:


root = Tkinter.Tk()
root.iconbitmap(default=ico_image_filename)

(on Linux I use root.iconbitmap(bitmap='@'+xbm_filename))


--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Progress Bar

2011-11-08 Thread Rance Hall
On Tue, Nov 8, 2011 at 9:42 AM, Nikunj Badjatya
 wrote:
> Hi All,
> I am writing an installer in Python and Powershell which will be used to
> install Virtual Machines at specific locations.
> The main script is in Python and main.py inturn calls Powershell scripts
> (.PS1).
> It is complete console based and no gui.
> I am using Python 2.7
> I was thinking to have a progress bar in my installer. similar to the way
> when we install something in linux via console and a progress bar comes as
> "[#                 ] 40% "
> etc.
> I also saw and ran couple of examples based in Python on the net.
> http://code.google.com/p/python-progressbar/source/browse/examples.py
>
> My question is, How do I integrate it with Powershell scripts.?
> I am using popen() to run powershell scripts.
>

The easiest way to do this is manually advance your progress bar with
each powershell script completion.

for example if there are four *ps1 scripts, then completing each
represents an additional 25% completion.

popen(ps script 1)
advance progress meter to 25%
popen(ps script 2)
advance progress meter to 50%
.

to get anything more sophisticated you have to have the powershell
scripts report something back to the main python script but I don't
have a feel for how easy/hard that would be.  I doubt that the popen
call allows much more than waiting for the called script to exit.

You could have the power shell scripts keep track of their own
progress with a log file or some such and then a thread in your python
installer could watch those log files and manually advance your
progress meter based on log file entries.

HTH

Rance
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] string split function - how to tell how many splits

2011-11-08 Thread Cranky Frankie
How do you tell how many splits the string split funtion returns? For example:

field = 'The Good Wife ;'   # a string separated by spaces
new_list = field.split(' ') # create a list of space delimited elements
print (new_list[0]) # print the first one
print (new_list[1]) # print the second one
print (new_list[2]) # print the third one
print (new_list[3]) # print the fourth one
print (new_list[4]) # print the fifth one


The last line above causes an error. I plan on reading in a file where
I don't know what the number of splits will be. How can I find out
before trying to access an out of range index?



-- 
Frank L. "Cranky Frankie" Palmeri, Guilderland, NY, USA
             Risible Riding Raconteur & Writer
Don't sweat the petty things, and don't pet the sweaty things.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] string split function - how to tell how many splits

2011-11-08 Thread Joel Goldstick
On Tue, Nov 8, 2011 at 11:56 AM, Cranky Frankie wrote:

> How do you tell how many splits the string split funtion returns? For
> example:
>
> field = 'The Good Wife ;'   # a string separated by spaces
> new_list = field.split(' ') # create a list of space delimited elements
> print (new_list[0]) # print the first one
> print (new_list[1]) # print the second one
> print (new_list[2]) # print the third one
> print (new_list[3]) # print the fourth one
> print (new_list[4]) # print the fifth one
>
>
> The last line above causes an error. I plan on reading in a file where
> I don't know what the number of splits will be. How can I find out
> before trying to access an out of range index?
>
>
>
> --
> Frank L. "Cranky Frankie" Palmeri, Guilderland, NY, USA
>  Risible Riding Raconteur & Writer
> Don't sweat the petty things, and don't pet the sweaty things.
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor


you can find the length of the list with the len() function

>>> field = 'The Good Wife ;'   # a string separated by spaces
>>> new_list = field.split(' ') # create a list of space delimited
elements
>>> len(new_list)
4


-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] string split function - how to tell how many splits

2011-11-08 Thread Steven D'Aprano

Cranky Frankie wrote:

How do you tell how many splits the string split funtion returns? For example:

field = 'The Good Wife ;'   # a string separated by spaces
new_list = field.split(' ') # create a list of space delimited elements
print (new_list[0]) # print the first one
print (new_list[1]) # print the second one
print (new_list[2]) # print the third one
print (new_list[3]) # print the fourth one
print (new_list[4]) # print the fifth one


The last line above causes an error. I plan on reading in a file where
I don't know what the number of splits will be. How can I find out
before trying to access an out of range index?


text = 'Nobody expects the Spanish Inquisition!!!'
words = text.split(' ')
number_of_words = len(words)
print words[number_of_words - 1]  # prints "Inquisition!!!"


--
Steven

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Single line webserver [was: Tutor Digest, Vol 93, Issue 38]

2011-11-08 Thread Steven D'Aprano

Rich Lovely wrote:


I'd like to draw your attention to my original message: "a google
search is similarly lacking in relevant results."  Shouldn't it be
clear from how easy it is to find SimpleHttp that it clearly /isn't/
what I'm looking for? Perhaps I should have mentioned that, but I
thought I'd made it clear I'd tried a websearch.


Yes, you should have mentioned that SimpleHttp was not the one-liner you 
were looking for. That would have been useful to know :)


Your request was for a one-liner web server, and you claimed to have 
done a search which came up with nothing relevant. Since a simple search 
did in fact come up with an apparently relevant one-liner, the most 
obvious conclusions were that your search skills are very lousy, or that 
you were mistaken (i.e. lying) about having attempted to search first. 
Coming from an apparent first-time poster with no reputation I was aware 
of, neither would have surprised me. I'm glad that neither is actually 
the case.




The code I remember was a Socket-based webserver, written in one -
albeit rather long - line.


That would have been useful information to have mentioned at the time.

For what little it's worth, here's a 15 line socket-based web server:


import socket
template = ('HTTP/1.0 200 OK\n\nWelcome %s!'
  'Header..and body.Your request was: '
  '"%s"')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(('', 8080))
sock.listen(1)
print "Listening on port 8080"
while True:
client, address = sock.accept()
cfile = client.makefile('rw', 0)
cfile.write(template % (str(address), cfile.readline().strip()))
cfile.close()
client.close()


Save this as "web.py", run "python web.py", and then in your browser go 
to http://localhost:8080


Turning this into a one-liner is left as an exercise. This may be useful:

http://pauldotcom.com/2011/10/python-one-line-shell-code.html



P.S. I note you're replying to the digest. Thank you for trimming your 
reply, rather than including the entire digest, but please note the 
request at the top of each digest:


When replying, please edit your Subject line so it is
more specific than "Re: Contents of Tutor digest..."



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] string split function - how to tell how many splits

2011-11-08 Thread Dave Angel

On 11/08/2011 11:56 AM, Cranky Frankie wrote:

How do you tell how many splits the string split funtion returns? For example:

field = 'The Good Wife ;'   # a string separated by spaces
new_list = field.split(' ') # create a list of space delimited elements
print (new_list[0]) # print the first one
print (new_list[1]) # print the second one
print (new_list[2]) # print the third one
print (new_list[3]) # print the fourth one
print (new_list[4]) # print the fifth one


The last line above causes an error. I plan on reading in a file where
I don't know what the number of splits will be. How can I find out
before trying to access an out of range index?


In general, the len() function tells you how many elements a collection 
has, and in particular split() returns a list, which is supported by len().


But for the printing example, you could also do:
   for item in newlist:
 print(item)



--

DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Single line webserver

2011-11-08 Thread Prasad, Ramit
>Windows Command Prompt gotta be the most powerful language on earth, it 
>has a full-blown server in a single word:

>C:\Program Files\Apache Software Foundation\Apache2.2\bin> httpd.exe



Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Alan Gauld

On 08/11/11 15:56, Steve Willoughby wrote:


I can't recall what it is, but its similar to the one used for setting
the title text on the Window, one of the wm_x calls.


I have an app I'm developing and running successfully on Windows ...

root = Tkinter.Tk()
root.iconbitmap(default=ico_image_filename)


Yep, that's the one I was thinking of. Looks like they must have fixed 
the problem. Last time I tried it ran without errors but didn't change 
the icon - that would have been with Python 2.2-3(ish) on Windows XP.

It was a known issue on the Tk forums...

Hmm, Googling, it looks like it was probably fixed in Tk 8.4.
Which is a wee while ago! :-)

Although I see it still being described as a bug up until April 2008 at 
least. The suggested "fix" being to edit the icon in wish.exe using a 
resource editor - yikes!




--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Progress Bar

2011-11-08 Thread Alan Gauld

On 08/11/11 15:42, Nikunj Badjatya wrote:


I am writing an installer in Python and Powershell which will be used to
install Virtual Machines at specific locations.


I see you got a reply from Rance.

But since this list is for folks learning the python language you would 
be more likely to get results on a more general Python users list (or 
even a Powershell specific list if such exists) such as the main 
comp.lang.python group.



--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Beginning Python From Perl

2011-11-08 Thread Jihad Esmail
Hi! I am new to this list so stick with me. I've recently taken interest in
learning Python. I have already learned Perl. How should I go about
learning Python from Perl? Please help. Thanks!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Peter Camilleri
I too learnt perl first and I came to learn python through the google
python class

http://code.google.com/edu/languages/google-python-class/

It has video lectures and exercises which should help you illustrate
the basic concepts in each video.

I am by no means an python expert, but I feel that series gave me
enough of an introduction to python to be able to go off and learn
anything else I needed to know about the language from online
tutorials.

On Wed, Nov 9, 2011 at 9:14 AM, Jihad Esmail  wrote:
> Hi! I am new to this list so stick with me. I've recently taken interest in
> learning Python. I have already learned Perl. How should I go about learning
> Python from Perl? Please help. Thanks!
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Another question about GUI applications.

2011-11-08 Thread Nathaniel Trujillo
I tried the code you suggested and I got the following error message.

Here is the code I tried.

root = Tkinter.Tk()
root.iconbitmap(default=ico_image_filename)

And here is the error message.

Traceback (most recent call last):
  File "C:\Python31\mad_lib.py.py", line 112, in 
root = Tkinter.Tk()
NameError: name 'Tkinter' is not defined

Thanks for the help.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Another question about GUI applications.

2011-11-08 Thread Steven D'Aprano

Nathaniel Trujillo wrote:


Traceback (most recent call last):
  File "C:\Python31\mad_lib.py.py", line 112, in 
root = Tkinter.Tk()
NameError: name 'Tkinter' is not defined


You have to import the Tkinter module first:

import Tkinter


--
Steven

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Joel Goldstick
start with python.org.  There is a tutorial and lots more

On Tue, Nov 8, 2011 at 5:14 PM, Jihad Esmail  wrote:

> Hi! I am new to this list so stick with me. I've recently taken interest
> in learning Python. I have already learned Perl. How should I go about
> learning Python from Perl? Please help. Thanks!
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Ken G.
Not necessary learning from Perl but I would recommend Alan Gauld's 
online website for learning Python from scratch:


http://www.alan-g.me.uk/

Good luck in learning Python.

Ken

On 11/08/2011 05:14 PM, Jihad Esmail wrote:

Hi! I am new to this list so stick with me. I've recently taken interest
in learning Python. I have already learned Perl. How should I go about
learning Python from Perl? Please help. Thanks!

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Steve Willoughby

On 08-Nov-11 14:14, Jihad Esmail wrote:

Hi! I am new to this list so stick with me. I've recently taken interest
in learning Python. I have already learned Perl. How should I go about
learning Python from Perl? Please help. Thanks!


I, too, was a long-standing Perl programmer before diving into Python. 
The most important thing, and I just can't stress this enough, is that 
you should seek to understand Python on its own terms first.  Learn the 
idioms and best practices of Python.  Perl and Python (and C and Ruby 
and Java and... and ...) each have their strengths, weaknesses, and 
their own way of approaching a problem.


If you just try to frame a program as you would in Perl, and "translate" 
the code into Python straight across, you'll get really crappy Python 
code and have a miserable time doing it.  Don't program in Perl in 
Python, in other words.


(Substitute "Perl" and "Python" with arbitrary languages of your choice.)


--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Another question about GUI applications.

2011-11-08 Thread Alan Gauld

On 08/11/11 22:41, Steven D'Aprano wrote:

Nathaniel Trujillo wrote:


Traceback (most recent call last):
File "C:\Python31\mad_lib.py.py", line 112, in 
root = Tkinter.Tk()
NameError: name 'Tkinter' is not defined


You have to import the Tkinter module first:



And since you seem to be using Python v3 its spelled

import tkinter

in lowercase...

Also:

root = Tkinter.Tk()
root.iconbitmap(default=ico_image_filename)

ico_image_filename

is a variable which you will need to define with
a real filename.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Alan Gauld

On 08/11/11 22:59, Ken G. wrote:

Not necessary learning from Perl but I would recommend Alan Gauld's
online website for learning Python from scratch:

http://www.alan-g.me.uk/


Thanks for the plug! :-)

But if you (the OP) already know Perl the standard official tutorial 
should be a great start. It will teach you the Python basics in a few hours.


And as Steve said, don't try to translate Perl to Python, that leads to 
awkward code that probably won't run very well.


It's a bit like translating a natural language like French into English. 
You translate the ideas not the words. Every language

has its own idioms and vernacular, a literal translation just
sounds odd. It's the same with programming languages.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Alan Gauld

On 08/11/11 15:56, Steve Willoughby wrote:


I have an app I'm developing and running successfully on Windows (as
well as OSX and Linux). At least in this case it is able to replace the
application icon in place of the default "TK" one. The code I use is:

root = Tkinter.Tk()
root.iconbitmap(default=ico_image_filename)



Steve,

I just checked the help:

-
>>> help (top.iconbitmap)
Help on method wm_iconbitmap in module tkinter:

wm_iconbitmap(self, bitmap=None, default=None) method of
tkinter.Tk instance
Set bitmap for the iconified widget to BITMAP. Return
the bitmap if None is given.
-

I note it says this sets the bitmap for the "iconified widget".
That to me means the icon on the desktop, or in the Taskbar.
Can you confirm that it also sets the icon at top left in
the title bar?

The basic icon was always set it is specifically the title
bar icon that was broken... Not having a Windows PC anymore
I can't test it...

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Steve Willoughby

On 08-Nov-11 16:38, Alan Gauld wrote:

I note it says this sets the bitmap for the "iconified widget".
That to me means the icon on the desktop, or in the Taskbar.
Can you confirm that it also sets the icon at top left in
the title bar?


Yes, it changes the top left of the application window.

To test, I made a "G" image and installed it.  Here's a screenshot of 
the app window with and without that code.




--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
<><>___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor