419 Archived Topics

Remove Filter
Member Avatar for lewashby

In the following code, could someone please explain these if statements? elif 5 <= unhappiness <= 10:, & elif 11 <= unhappiness <15:, they have two arguments, one on each side which is something I haven't seen before. Also, what the one to the far right for anyway? Also, this …

Member Avatar for masterofpuppets
0
154
Member Avatar for lewashby

Please look at the program below as well as my understanding of how it flows and correct me if I'M wrong. Thanks The first line in main - [COLOR="Red"]crit = Critter("Poochie")[/COLOR], creates an object with the string "Poochie" and autmoatically calls [COLOR="Red"]__init__[/COLOR], printing "A new critter has been born!" [COLOR="Red"]__init__ …

Member Avatar for lewashby
0
175
Member Avatar for lewashby

I have to prgrams and thus, two question to ask. In the following program how does the line [COLOR="Red"]status = staticmethod(status)[/COLOR] do anything? My python programming book somehow connects it to the line [COLOR="Red"]Critter.total +=[/COLOR] 1 but I don't see how? Please explain. [CODE]# Classy Critter # Demonstrates class attributes …

Member Avatar for vegaseat
0
194
Member Avatar for lewashby

In the following program, I'M getting the following error message when I try to run it. [COLOR="Red"]TypeError: object.__new__() takes no parameters[/COLOR] [CODE] # Classy Critter # Demonstrates class attributes and static methods class Critter(object): """A virtual pet""" total = 0 def status(): print "\nThe total number of critters is", Critter.total …

Member Avatar for pythopian
0
551
Member Avatar for lewashby

In the following program, at what point does my program call the _str__ method/constructor? I don't see it specifically being called at any point. I know it happens with this line print [CODE]"Printing crit1:" print crit1[/CODE] but I still don't see how or when this happens. Thanks for any and …

Member Avatar for mn_kthompson
0
203
Member Avatar for lewashby

How do I get my python code to compile one line at a time so I can see exactly how the code works. If anyone knows how to do this with Wing IDE that would also be helpful. Thanks.

Member Avatar for Mathhax0r
0
79
Member Avatar for lewashby

I'M reading the book "Python Programing second edition for the absolute beginner". While explaining the object paramater whithin a class, this how it reads. Base your class on [I]object[/I] , a fundamental, built-in type. Can someone please tell me what that means? Thanks.

Member Avatar for mn_kthompson
0
131
Member Avatar for lewashby

Does anyone know where I can find a goo pdf python reference for the following? pre built constructors, functions/methods for the follwoing tuples, lists, dicts...etc I hate reading a book with nothing but quick explanation, I want to see them for myself. And I already know how to find them …

Member Avatar for python user
0
187
Member Avatar for lewashby

These three things are holding me back. 1. The new style class object parameter - [CODE]class MyClass(object)[/CODE] [INDENT]Note that I'M also also not familir with the old style[/INDENT] 2. The [CODE]_init_([/CODE] - constructor, or any constructs for that matter. 3. The [CODE](self)[/CODE] parameter. How is it different from the normal …

Member Avatar for vegaseat
0
89
Member Avatar for lewashby

I am currently reading two books, one on PHP and one on Python. Not that I'M good at ether. I'M about half way through the book on PHP or less and almost done with the one on Python. Though I haven't actually read anything web related in this particular Python …

Member Avatar for pythopian
0
635
Member Avatar for lewashby

First of all, I'M reading the book "Microsoft XNA Game Studio 2.0". I understand the error I'M getting but I don't know what to do about it. The error says I can't use backgroundColor before it has been declared. I'M following along with the book so I don't see why …

Member Avatar for jbennet
0
140
Member Avatar for lewashby

I recently posted a very small program the uses pygame and the livewires package but was unable to get the program to run. I think the Title for that posting was Graphics Window or something close to that anyway. Since I can't resolve that problem, does anyone have any suggestions …

Member Avatar for vegaseat
0
102
Member Avatar for lewashby

I have installed pygame and livewires but am getting the following error with the following short program that I got from my python book. [COLOR="Red"]AttributeError: 'module' object has no attribute 'init'[/COLOR] [CODE]# New Graphics Window # Demonstrates creating a graphics window from livewires import games games.init(screen_width = 640, screen_height = …

Member Avatar for vegaseat
0
236
Member Avatar for lewashby

How do you know when to use a function by wraping the content between parentheses "function(x) or through dot notation x.function() ? thanks.

Member Avatar for masterofpuppets
0
161
Member Avatar for lewashby

I the following program, can someone please explain these two lines. "def __init__(self, master):, & Frame.__init__(self, master)" One other thing. Shouldn't the method "update_count" use a return to return the new count? thanks. [CODE]# Click Counter # Demonstrates binding an event with an event handler from Tkinter import * class …

Member Avatar for vegaseat
0
199
Member Avatar for lewashby

I more than half way through the book "Python programming for the absolute beginner" 2nd Ed. and things are really starting to get hairy. The book has me to write some code just before or after explaining each part. But I have to really concentrate on the paragraph I'M reading …

Member Avatar for willygstyle
0
304
Member Avatar for lewashby

I more than half way through the book "Python programming for the absolute beginner" 2nd Ed. and things are really starting to get hairy. The book has me to write some code just before or after explaining each part. But I have to really concentrate on the paragraph I'M reading …

Member Avatar for vegaseat
0
120
Member Avatar for lewashby

In the program below, how does the value "Poochie" know where to go in the line [CODE]crit = Critter("Poochie")[/CODE] And how do the get_name and set_name functions know when to do their thing, they don't seem to get called or anything? Thanks. [CODE]# Property Critter # Demonstrates get and set …

Member Avatar for Gribouillis
0
738
Member Avatar for lewashby

I'M reading a book on Python and my very first object/constructor program isn't show the output that the book is showing. I lacks the two lines "A new critter has been born!" [CODE]# Constructor Critter # Demonstrates constructors class Critter(object): """A virtual pet""" def _init_(self): print "A new critter has …

Member Avatar for lllllIllIlllI
0
121

The End.