[Tutor] Tkinter Documentation

2013-03-30 Thread Clyde Wilson
Is there a fairly complete set of documentation on-line for Tkinter?
I'm using Python 3.3 on Windows.
 ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tkinter Documentation

2013-03-30 Thread Mark Lawrence

On 30/03/2013 23:16, Clyde Wilson wrote:

Is there a fairly complete set of documentation on-line for Tkinter?
I'm using Python 3.3 on Windows.


http://docs.python.org/3/library/tkinter.html

--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

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


Re: [Tutor] Tkinter Documentation

2013-03-30 Thread Alan Gauld

On 30/03/13 23:25, Mark Lawrence wrote:

On 30/03/2013 23:16, Clyde Wilson wrote:

Is there a fairly complete set of documentation on-line for Tkinter?
I'm using Python 3.3 on Windows.


http://docs.python.org/3/library/tkinter.html


This contains links to most of the resources you need but its important 
to remember when dealing with Tkinter that it is tracking the underlying 
Tk widget set. There are a lot of undocumented or poorly documented 
features and options in that set and it changes on a fairly regular 
basis with new releases. For example the original Ousterhout book is now 
so far out of date it is really only useful for understanding the basic 
philosophy and structure of Tcl/Tk.


There are several good Tk reference sites but you have to translate 
Tcl/Tk into Python to use them. Some sites give multi-lingual examples, 
for example:


http://www.tkdocs.com/

Which is incomplete but slowly growing and has examples in Tcl and Ruby.
(The tutorial section has Perl and Python too...)

This is the official Tk site (all tcl based)

http://www.tcl.tk/man/tcl8.5/TkCmd/contents.htm

And of course don't forget Tix which is also part of the Tkinter library 
support in Python now.


http://tix.sourceforge.net/man/html/TixCmd/TixIntro.htm#M11


--
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] (no subject)

2013-03-30 Thread Soliman, Yasmin
Hello everyone. How can I get a program to stop only when the user enters 
'Quit'?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 11:49 AM, Soliman, Yasmin  wrote:
> Hello everyone. How can I get a program to stop only when the user enters 
> 'Quit'?

You would need an "infinite" loop in your program, where you take user
input. Check if the input entered was 'Quit', and only exit/break out
of your loop then, else continue doing something else.

HTH,
-Amit.


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


Re: [Tutor] (no subject)

2013-03-30 Thread Steven D'Aprano

On 31/03/13 12:49, Soliman, Yasmin wrote:

Hello everyone. How can I get a program to stop only when the user enters 
'Quit'?


First you need a program that never stops. Most programs automatically stop 
when they're done, so you need to have a program which repeats forever. Do you 
have that?

Then you need to add code that asks the user for input.

Then you need to add code that compares that input to "Quit".

And finally you need to add code that exits when they match.


# Step 1. A program that never stops.
while True:
print "Hello world"  # Or do something useful.


# Step 2. Add code that repeatedly gets input from the user.
while True:
print "Hello world"
response = raw_input("What do you want to do? ")


# Step 3. Inspect that input.
while True:
print "Hello world"
response = raw_input("What do you want to do? ")
if response == "Quit":
print "Exiting now" # Well, not now, but soon.


# Step 4. Exit when done.
while True:
print "Hello world"
response = raw_input("What do you want to do? ")
if response == "Quit":
break  # escapes from the while loop



Step 5. Make the program useful. That's up to you.





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


[Tutor] Fwd: (no subject)

2013-03-30 Thread Amit Saha
Sorry, forgot to have tutor in the CC.

On Sun, Mar 31, 2013 at 12:08 PM, Soliman, Yasmin  wrote:
> Sure here it is:
>
> import weekday_string1
> while True:
> ryear = raw_input("year= ")
> print ryear
> if not ryear.isdigit():
> print '\nThank you for using this program! Bye.'
> break

if ryear == 'Quit':
print '\nThank you for using this program! Bye.'
break

This will exit out of the While loop. So, if you have code after the
while loop, they will be executed. If you want to completely exit the
program, use the sys.exit() function from the sys module.

Does that help?

-Amit.


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


Re: [Tutor] FW: Fwd: (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 12:51 PM, Soliman, Yasmin  wrote:
> yes, your program does work. The problem is if I run that similar statment in 
> my program, say I enter the year and for month I write Quit, it says quit is 
> not defined. I suppose in this senerio I would have to use the sys.exit()?

Do you mean that you want to quit if *any* of your inputs is given as
'Quit' ? The something like this should work:

import weekday_string1
while True:
ryear = raw_input("year= ")
print ryear
if ryear=='Quit':
print '\nThank you for using this program! Bye.'
break
else:
year = int(ryear)
month = raw_input("month= ")
day = raw_input("day= ")

   if month=='Quit' or day == 'Quit':
   break

wd = weekday_string1.weekday_string(year, int(month), int(day))
print "The given date: %2d/%2d/%4d is a %s." % (month, day, year, wd)
print "=="


Couple of things here:

1. I have used raw_input() to take the input for month and day as well
(Why? See the differences between input() and raw_input():
http://echorand.me/2012/10/11/input-and-raw_input-in-python/)

2. Since raw_input() returns its input as a string, I use the int()
function when I call your weekday_string() function with month and
date.

Does that help?

-Amit.


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


Re: [Tutor] FW: Fwd: (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 12:39 PM, Soliman, Yasmin  wrote:
> So if it should look like this, it gives error that says Quit is not defined, 
> also why does it not recognize the sys import when I run it?
>
> import weekday_string1
> import sys
> while True:
> ryear = raw_input("year= ")
> print ryear
>
> if ryear == 'Quit':
> print '\nThank you for using this program! Bye.'
> break

Okay, here is a small program:

while True:
ryear = raw_input("year= ")
print ryear

if ryear == 'Quit':
print '\nThank you for using this program! Bye.'
break
else:
print 'Not quitting'

When I run this, I see:

year= 10
10
Not quitting
year= 10
10
Not quitting
year= 20
20
Not quitting
year= Quit
Quit

Thank you for using this program! Bye.

As you can see, when I enter "Quit", it exists. Can you try and see if
that works for you?

Best,
Amit.

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


Re: [Tutor] FW: Fwd: (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 1:14 PM, Soliman, Yasmin  wrote:
> Yes this does help. I'm going to play around with it a bit, thank you so much 
> for your patience and time!

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