[Tutor] NameError: is defined

2011-07-19 Thread brandon w
Hi I am running Linux with Python 2.6.6. I have done lists, tuples, dictionaries, etc. Now I want to move on to creating a "class". I keep getting an error for everything I try. Here is the error: * NameError: name 'MyClass' is not defined* I had originally tried to create my own class by wat

[Tutor] Running Python in script vs. Idle

2011-07-24 Thread brandon w
Python version 2.6.6 I wrote this in Idle and ran it in Idle and it worked fine. class ExClass: eyes = "brown" age = 99 height = '5\'11' def thisMethod(self): return 'This method works.' This is me running it in Idle. >>> ExClass ** >>> x = ExClass() >>> x.eyes *'brown'

Re: [Tutor] Running Python in script vs. Idle

2011-07-24 Thread brandon w
On 07/24/2011 07:59 PM, Steven D'Aprano wrote: brandon w wrote: Thank you. I understand that this ( x = 1+2 ) assigns a variable to "x" and will not print in Idle, but how would I get the 'class' that I created to run from the script like it does in Idle? Will I

[Tutor] When to use def __init__ when making a class?

2011-08-02 Thread brandon w
I have two questions: 1) When should I use "def __init__(self):" when I create a class? 2) Would these two classes have the same effect? class Name: def __init__(self): man = Marcus woman = Jasmine return self.man, self.woman class Na

Re: [Tutor] When to use def __init__ when making a class?

2011-08-03 Thread brandon w
On 08/02/2011 09:09 PM, Brett Ritter wrote: On Tue, Aug 2, 2011 at 8:47 PM, brandon w wrote: 1) When should I use "def __init__(self):" when I create a class? When you have any initialization to do. (in other words, when you want class instantiation to do more than simpl

Re: [Tutor] When to use def __init__ when making a class?

2011-08-03 Thread brandon w
On 08/02/2011 09:25 PM, Steven D'Aprano wrote: brandon w wrote: I have two questions: 1) When should I use "def __init__(self):" when I create a class? Whenever you need something to happen when you create an instance. 2) Would these two classes have the same effect?

[Tutor] Tkinter: no module named messagebox

2011-08-13 Thread brandon w
I have tried to follow the tutorial I found here: Python 2.7 Tutorial http://www.youtube.com/watch?v=uh6AdDX7K7U This is what I have done so far: #!/usr/bin/python from Tkinter import * import Tkinter.MessageBox myapp = Tk() myapp.title("This is the gui title") myapp.geometry("500x500+600+600

Re: [Tutor] Tkinter: no module named messagebox

2011-08-13 Thread brandon w
On 08/13/2011 04:49 PM, Peter Otten wrote: `python -c 'import Tkinter, os; print os.path.dirname(Tkinter.__file__)'` Thanks dude. That is some really useful information. That will help me for future coding. I found that I needed to use "from tkMessageBox import *" to get it to work. ___

Re: [Tutor] Python

2011-08-13 Thread brandon w
On 08/13/2011 05:56 PM, Jon wrote: Could you link me to some beginners tutorials/idle codes thank you. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor Check out so

Re: [Tutor] Tkinter: no module named messagebox

2011-08-13 Thread brandon w
On 08/13/2011 04:49 PM, Peter Otten wrote: brandon w wrote: I have tried to follow the tutorial I found here: Python 2.7 Tutorial http://www.youtube.com/watch?v=uh6AdDX7K7U This is what I have done so far: #!/usr/bin/python from Tkinter import * import Tkinter.MessageBox myapp = Tk

[Tutor] tkinter.TclError

2011-08-13 Thread brandon w
Here is the code: #!/usr/bin/python from Tkinter import * from tkMessageBox import * def iClicked(): radioValue = relStatus.get() tkMessageBox.showinfo("You clicked", radioValue) return def chLabel(): name = "Thank you for clicking me. " + your_name.get() labelText.set(name

Re: [Tutor] python

2011-08-14 Thread brandon w
On 08/14/2011 09:04 AM, je.rees e-mail wrote: I have made a small program but I would like to know how to write or. There is multiple choice answer. Good=raw_input("Good to hear") ok=raw_input("Good good") Bad=raw_input("Oh dear") I would only like the person using the program to be able to pick

Re: [Tutor] Tkinter: no module named messagebox

2011-08-16 Thread brandon w
On 08/14/2011 02:29 AM, Peter Otten wrote: brandon w wrote: On 08/13/2011 04:49 PM, Peter Otten wrote: How do I find the modules in Tkinter? The simplest approach is probably to explore your file system: Step 1: where's Tkinter? $ python -c 'import T

Re: [Tutor] Tkinter: no module named messagebox (brandon w)

2011-08-16 Thread brandon w
On 08/14/2011 03:10 AM, Robert Sjoblom wrote: I have tried to follow the tutorial I found here: Python 2.7 Tutorial http://www.youtube.com/watch?v=uh6AdDX7K7U This is what I have done so far: #!/usr/bin/python from Tkinter import * import Tkinter.MessageBox I figured I might as well, g

Re: [Tutor] Tkinter: no module named messagebox (brandon w)

2011-08-16 Thread brandon w
On 08/14/2011 11:14 AM, Alan Gauld wrote: On 14/08/11 14:07, Wayne Werner wrote: Of course I personally I usually do import Tkinter as tk Which means I only have to type 3 extra characters, but it removes any ambiguity - tk.Something had to come from Tkinter Thats exactly what I tend to do n

[Tutor] Printing in the same place

2011-08-16 Thread brandon w
I am trying to print in the same place to make a clock in a tkinter window. I will loop the following code to update the time. This seems to work but it is not printing in the same place: #!/usr/bin/python #Python 2.6.6 import time for t in range(5): digits = time.strftime('%H:%M:%S')

Re: [Tutor] Printing in the same place

2011-08-17 Thread brandon w
On 08/17/2011 04:02 AM, Alan Gauld wrote: On 17/08/11 04:05, brandon w wrote: I am trying to print in the same place to make a clock in a tkinter window. I will loop the following code to update the time. This is not a tkinter program so its completely irrelevant to your stated aim. In tkinter

[Tutor] Tkinter: Deleting text when clicking in field.

2011-08-20 Thread brandon w
I worked on this for a long time. I did many searches to fix the many error messages I was getting and I finally got this to work. I would now just like to have the text disappear when a person clicks in the box to type something. How can I do that? (This is just a sample of the whole program.

Re: [Tutor] Tkinter: Deleting text when clicking in field.

2011-08-20 Thread brandon w
On 08/20/2011 07:11 PM, Alan Gauld wrote: On 20/08/11 20:12, brandon w wrote: I worked on this for a long time. I did many searches to fix the many error messages I was getting and I finally got this to work. I would now just like to have the text disappear when a person clicks in the box to

[Tutor] Tkinter Entry field text

2011-09-08 Thread brandon w
How do you display text in a Entry field and have it disappear when a person clicks in it? This is what I have so far: from Tkinter import * root = Tk() root.title("Password Changer") root.geometry("300x300+600+250") label1 = Label(root, text="Enter you password: ") label1.grid(sticky=W, row

Re: [Tutor] Tkinter Entry field text

2011-09-10 Thread brandon w
On 09/10/2011 10:16 AM, Wayne Werner wrote: On Thu, Sep 8, 2011 at 9:31 PM, brandon w <mailto:thisisonlyat...@gmx.com>> wrote: How do you display text in a Entry field and have it disappear when a person clicks in it? To get text into this box the person must first de

[Tutor] My code works but it is a little bit broken.

2011-09-25 Thread brandon w
This code calculates money. The problem is that in the first field after the mouse enters a second time updates itself with the value from the last field. I don't want it to do that. I think that the problem is in the "callback" method. #!/usr/bin/python from Tkinter import * root = Tk() root.t

Re: [Tutor] My code works but it is a little bit broken.

2011-09-26 Thread brandon w
at 4:03 AM, Alan Gauld wrote: > On 26/09/11 03:25, brandon w wrote: > >> This code calculates money. The problem is that in the first field after >> the mouse enters a second time updates itself with the value from the >> last field. I don't want it to do that. >>

Re: [Tutor] My code works but it is a little bit broken.

2011-09-27 Thread brandon w
That was my problem. I had the "insert" function. I don't know why I did not see that before or why I even put that in there. Thank you for your help once again. On Tue, Sep 27, 2011 at 6:43 AM, Alan Gauld wrote: > On 27/09/11 02:32, brandon w wrote: > >> The fields

[Tutor] How to Capture a key being pressed?

2012-01-04 Thread brandon w
How do I capture a key like the bar or the key? Is there anything that comes in the default Python2.6.6 installation? I have found something called "termios" doing a search. Should I just use Pygame? I would like it to go cross platform if possible. Brandon __

[Tutor] How to hide cursor in Terminal?

2012-02-17 Thread brandon w
I made a timer that counts down from five minutes. This code runs fine but I a seeing a cursor blinking on the first number as the code is running. How do I avoid this? I am using gnome-terminal and Python 2.6.6. #!/usr/bin/python import time import sys import os def countd(): seconds = 5

Re: [Tutor] How to hide cursor in Terminal?

2012-02-17 Thread brandon w
help! Now I'll have to see if I can get the same thing working on a Windows machine. Brandon On Fri, Feb 17, 2012 at 2:00 PM, Alan Gauld wrote: > On 17/02/12 11:38, brandon w wrote: > >> I made a timer that counts down from five minutes. This code runs fine >> but

[Tutor] Python using RXVT vs Konsole?

2012-03-08 Thread brandon w
I have noticed the difference in terminals when using the Python interpreter. I am able to up-arrow to get the last typed command using rxvt but when I use konsole and I press the up-arrow I get the symbols: ^[[A Why is that? Is this the right place to ask this question? I want to be able to use th

Re: [Tutor] Python using RXVT vs Konsole?

2012-03-08 Thread brandon w
ar 08, 2012 at 09:07:46PM -0500, brandon w wrote: > > I have noticed the difference in terminals when using the Python > > interpreter. > > I am able to up-arrow to get the last typed command using rxvt but when I > > use konsole and I press the up-arrow I get the symbols: ^[[A

Re: [Tutor] Python using RXVT vs Konsole?

2012-03-10 Thread brandon w
to remove characters from the current line. http://pytut.infogami.com/node4.html konsole somehow disabled command line editing. On Fri, Mar 9, 2012 at 3:49 AM, Alan Gauld wrote: > On 09/03/12 02:07, brandon w wrote: > > I am able to up-arrow to get the last typed command using rxvt bu

[Tutor] Questions about classes

2012-11-12 Thread brandon w
I have been trying to understand classes. I have been studying from a book I picked up recently. I have two questions about them. 1. I saw in the book an assignment written like this: class HumanBeing: def makeName(self, name): *self.name = name* * * Why is it not writte