Posts
 
Reputation
Joined
Last Seen
Ranked #3K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
12
Posts with Upvotes
12
Upvoting Members
7
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
3 Commented Posts
~100.46K People Reached
Interests
Love to bake, read, write, and play video games.
PC Specs
Ubuntu Linux
Favorite Tags

63 Posted Topics

Member Avatar for ultimatebuster

Not unless you are going to use "exec()" and people advise against that. The second way is a good way. [CODE]class Test: def Testing(self): # Run function x = Test() x.Testing()[/CODE]

Member Avatar for tomas_petricek
1
32K
Member Avatar for adanaz

[QUOTE=adanaz;1151545]Thanks for the advice but I'm trying to make my game retro, like the old text based games such as Zork etc. The green text on a black background is classic.[/QUOTE] Honestly, get pygame. Its easy to do a text based game with pygame. It will make a screen, and …

Member Avatar for DubWine
0
18K
Member Avatar for D3BuG

2nd part: Do something like this [CODE]func_dict = {'n':north, 's':south, 'e':east, 'w':west, 'i':inventory} # This dictionary uses the key letter you want, and the function you want to use letter = raw_input('Welcome to Town Square.\n').lower() # Letter is always lowercase by using '.lower()' if func_dict.has_key(letter): func_dict[letter]() else: print 'Invalid key'[/CODE] …

Member Avatar for D3BuG
0
166
Member Avatar for gunneronaspooky

I am pretty sure if you don't handle the error, it quits your program. Try this. [CODE]def inputNumber () : x = input (’Pick a number: ’) if x == 17 : raise ValueError, ’17 is a bad number’ return x try: inputNumber() except ValueError: print 'You picked 17'[/CODE]

Member Avatar for gunneronaspooky
0
178
Member Avatar for linux

Why is this solved? lol. I was handling the handling of variables (Until my 3rd computer wipe, which caused me to stop working on my RPG) like so [CODE]class Hero: """The hero class""" def __init__(self, name, id, race, stats, level=1): """ Creates the Hero""" self.name = name # Sets the …

Member Avatar for richieking
0
5K
Member Avatar for kur3k
Member Avatar for akkarin1313
Member Avatar for woooee
0
2K
Member Avatar for novice20

I know with Ubuntu, you can install 2.6, 2.7, and 3.0 in addition to the 2.5 it comes with. And since Ubuntu, being a derivative of Debian, shares many packages with Debian, maybe you can too. But Grib is right about the rest of it.

Member Avatar for npmaier
0
178
Member Avatar for knan

Show us some code. [CODE]file1 = open(filname) # Opens a file to read words_in_file = file1.read() # Reads everything in the file[/CODE]

Member Avatar for griswolf
0
322
Member Avatar for redyugi

This is used for finding the roots of a parabola. The parabola must have a number in front of x2 (x squared), a number in front of the single x, and a following number, or you can have a perfect square parabola. (in the form "number x2 - number") This …

Member Avatar for redyugi
0
452
Member Avatar for vmars
Member Avatar for Stefano Mtangoo
0
398
Member Avatar for Elihu5991

fixed! [URL="http://stackoverflow.com/questions/242304/where-should-i-download-corflags-exe-from"]http://stackoverflow.com/questions/242304/where-should-i-download-corflags-exe-from[/URL] [URL="http://www.bluej.org/download/download.html"]http://www.bluej.org/download/download.html[/URL]

Member Avatar for Elihu5991
0
293
Member Avatar for sss33

over? You mean on a different line?? If so, you should use a line break. [CODE]out = open('output.jh') towrite = a+'\n'+b out.write(towrite)[/CODE]

Member Avatar for cghtkh
0
99
Member Avatar for softbrianes

There is no need to make 2 threads in the span of an hour on the same topic. Also, can you show us some effort on your part? It looks like a simple ceasar cypher to me though.

Member Avatar for redyugi
0
53
Member Avatar for bettersaid

I'd imagine it'd be something like [CODE]import os import glob # If you are running *nix. Looks like you are mypath = '/Desktop/directory/' files_in_directory = glob.glob(mypath) # Creates a list of all the files in your directory '''This a comment. If you only wanted, say text files to show up …

Member Avatar for redyugi
0
133
Member Avatar for jtaylor-bye

Try this [CODE]import pygame from pygame.locals import * from sys import exit from random import * pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) run = True while run: for event in pygame.event.get(): if event.type == QUIT: run = False # Exits the loop. Not sure if 'exit()' was defined break …

Member Avatar for redyugi
0
3K
Member Avatar for Ghostenshell
Member Avatar for Ghostenshell
0
217
Member Avatar for gunneronaspooky

A few things. [CODE]int(raw_input())[/CODE] is safer then [CODE]input()[/CODE] And second, what if they input a letter? It will just raise an error. Do you want to do something with it?

Member Avatar for gunneronaspooky
0
133
Member Avatar for lionaneesh

That is because you are comparing strings. If If all the numbers were integers or floats, 10.24 would be the max.

Member Avatar for redyugi
1
3K
Member Avatar for redyugi

I have recently redid an earlier version of my version of Pong. However, I am having a slight issue with it. Whenever the ball hits the opposing paddle and then hits the bottom, the ball travels along the bottom until the player paddle hits it. I have tried for days …

0
103
Member Avatar for ultimatebuster
Member Avatar for GuyClapperton

Most video games do benefit the user in some way or another. Hand-eye coordination is a widely known one, for instance. Another, brainstorming and fast planning skills. If you keep dying by getting shot at one point in the story, then you must make up a plan(brainstorming). If you are …

Member Avatar for dirkmack
0
252
Member Avatar for locomotive
Member Avatar for lewashby

There is a Clock class. I use it all the time. Go to the pygame documentation, and it will show you all the methods in it. It will be in the 'time' documentation

Member Avatar for redyugi
0
47
Member Avatar for Joeflims

That is because the variable 'celsius' was never defined. [CODE]def get_celsius(celsius): celsius=int(raw_input("Type in the Celsius temperature: " )) # use 'int(raw_input())' instead of 'input()' return celsius def main(celsius): # Pass the variable in new = get_celsius(celsius) # When you return a value, you should store it in a variable farenheit=(9.0/5.0)*new+32 …

Member Avatar for Joeflims
0
137
Member Avatar for rehber344

Why don't you try it? If you are using Idle or another IDE, using the interactive prompt. If you are using Linux, using the command line to get into the python interactive prompt. (For Windows users, does that same thing work in Windows? Never tried it)

Member Avatar for redyugi
0
69
Member Avatar for JDuch
Member Avatar for JDuch
0
188
Member Avatar for PythonNewbie2

Mac has py2app (not sure the address) Have never used solaris so I have no clue. cx_freeze is for linux (though I have never had any luck with it)

Member Avatar for Beat_Slayer
0
193
Member Avatar for lewashby

1) You are using those variables to be passed into a function (pygame.draw.rect). This function expects the variables to be in a tuple/list. 2) 639 is one less then the width of the screen. It will make sure that you are not drawing off the screen. The dash is the …

Member Avatar for TrustyTony
-1
310
Member Avatar for Kruptein

gEdit does most of that already. And I am quite happy using Eric IDE. But, I will try it, and comment back here on it

Member Avatar for redyugi
0
102
Member Avatar for yari
Member Avatar for yari
0
3K
Member Avatar for student_

Why do you need separate modules? Its small enough not to really matter... Python is case-sensitive so when you import something, it must follow the same case You use import at the beginning. [CODE]from makeAge import makeAge from makeName import makeName def main(): name = makeAge() age = makeAge() main()[/CODE]

Member Avatar for student_
0
82
Member Avatar for ultimatebuster

I think it would be [CODE]import os os.path.join('root/module1') os.path.join('root/module2') import somescript import someotherscript[/CODE]

Member Avatar for lrh9
0
158
Member Avatar for hamstes
Member Avatar for ichigo_cool

I am currently doing the same in Python. The key is to plan it out first, then start text-based, then move on to graphics. Much easier that way

Member Avatar for mike_2000_17
0
121
Member Avatar for wolfeater017

I thought pygame didn't work with 3.X? If it does, it should still follow the same instructions. 1) Load image (pygame.image.load(image)) 2) Blit onto display screen (screen_variable.blit(image, image.coordinates)) 3) Update display (pygame.display.update())

Member Avatar for vegaseat
0
2K
Member Avatar for basgen

Well you could do it like this. [CODE]while True: event_list = pygame.event.get() for event in event_list: if event.type == pygame.KEYDOWN and event.key == pygame.K_TAB: event_list.append(pygame.event.Event(pygame.KEYDOWN, {'key':pygame.K_LALT})[/CODE] I think that would work

Member Avatar for basgen
0
116
Member Avatar for job2

[CODE]int(input('blah blad'))[/CODE] is correct for 3.X for 2.X it is [CODE]int(raw_input('blah blah'))[/CODE] now for your question [CODE]if sum(foo[1:3]) == 11: # do something elif sum(foo[1:3]) == 1: # do something else[/CODE]

Member Avatar for TrustyTony
0
140
Member Avatar for wolfeater017

Try this. [CODE]font1 = pygame.font.SysFont('ActionIsShaded', 12)[/CODE]

Member Avatar for vegaseat
0
5K
Member Avatar for TrustyTony

I just took Algebra 2/ Trig, and this was extremely annoying. I knew to do it in my head, but, just like ultimatebuster, my teacher took off for it. I get Calc next year, and i hope there isn't any of this

Member Avatar for Skyelher
0
341
Member Avatar for mastermoo420

Moo, how did you get to that? Its very different then it was before. This is a better way to check if a user have entered a "yes" [CODE]if (import_yn in "y yes yeah".split()): #code[/CODE]

Member Avatar for mastermoo420
0
109
Member Avatar for redyugi

[CODE]class Test: def __init__(self, number): self.number = number def getnumber(self): return self.number x = Test(54) y = 'number' print x.getnumber() try: print(eval('%s.%s'% (x, y))) except Exception, e: print(e)[/CODE] This isn't the code I want to fix, but it has the same error. I am trying to return a class function …

Member Avatar for redyugi
0
138
Member Avatar for pyprog

You didn't do it properly the way you set it up. You can do one of a few ways. I will show you the two I use 1) change line 11 to [CODE]self.owner = owner[/CODE] Then when you are running it, create an Owner first, then pass that into the …

Member Avatar for pyprog
0
108
Member Avatar for WildBamaBoy

Because you are checking for a string, when you changed the variable "amount" to a float. change line 11 to [CODE]if amount == 0:[/CODE] or this [CODE]if not amount:[/CODE]

Member Avatar for WildBamaBoy
0
159
Member Avatar for redyugi

Lets say I have a class. It holds other classes in it. ex [CODE]class Test: def__init__(self, name): self.name = name def getname(self): print(self.name) class Holder: def __init__(self, tests): self.tests = tests def getnames(self): for i in self.tests: print( i.getname())[/CODE] so lets say I pickle an instance of Holder with 3 …

Member Avatar for redyugi
0
118
Member Avatar for nsutton
Member Avatar for DayneD89
Member Avatar for Toddh86

[CODE]line = f.readline() # Grabs your line sline = line.split() # Breaks your string into a list, separating it at " " surname = sline[1] # Grabs the second part of the list, which is the surname print surname[/CODE]

Member Avatar for TrustyTony
0
360
Member Avatar for jcao219

I for one, am waiting for more 3rd party modules to switch over to 3.X. Then I will start using 3.X more

Member Avatar for hondros
0
208
Member Avatar for ultimatebuster

As far as I know, you can't limit what a variable can be. However, you can check if the variable is an instance of class by using [CODE]isinstance(arg1, arg2) # Arg1 is the variable, Arg2 is the class[/CODE] That will return a truth value of True if it is an …

Member Avatar for ultimatebuster
0
566

The End.