244 Posted Topics

Member Avatar for kes_ee

Because your temporary list is the same thing as your other list. You said [icode]temp_list1 = list1[/icode]. This means that the value for temp_list1 will be the same address in memory as the value for list1, i.e. they reference the same thing. Modifying one modifies the other because they are …

Member Avatar for vegaseat
0
130
Member Avatar for rockyman12

There are [I]plenty[/I] of things you could have easily found through Google. You're just showing absolutely no effort on your part.

Member Avatar for Ene Uran
0
125
Member Avatar for Zachster

Please take Ancient Dragon's advice. If you don't even know how to compile and run a C++ program, you obviously shouldn't be working on a game. Look up tutorials and books on the language so that you can actually get an understanding of how it all works, then practice. And …

Member Avatar for shadwickman
-1
55
Member Avatar for masterofpuppets

Also, please put your code in [noparse][code][/code][/noparse] tags next time so that the indentation is kept, as it's a crucial part of Python. Other than that, I'm still confused what you are having a problem with. Maybe the removing of the number from the whole square has to do with …

Member Avatar for masterofpuppets
0
120
Member Avatar for joe82

And make sure that your file isn't some huge size that you shouldn't be loading into memory all at once. You can just go through the lines with the [icode]xreadlines()[/icode] iterator instead. [code=python] # this requires the output file to already exist and it should be # blank, as opening …

Member Avatar for joe82
-1
179
Member Avatar for aayush2687

Before trying to create a game, try learning a programming language first so that you understand how it works and you've grasped the basics. If you want games anyway, I'd suggest C++, but for simple 2D stuff you can use Python + pygame. @Salem Thank you for posting that link …

Member Avatar for Stinomus
0
272
Member Avatar for leegeorg07

As for making the keylogger, you may want to have a look at [URL="http://pyhook.wiki.sourceforge.net/"]pyhook[/URL], which can capture all keyboard events and mouse clicks in Windows (so even when your program's window isn't in focus). Definitely a useful thing to have access to for your purposes.

Member Avatar for shadwickman
0
178
Member Avatar for funfullson

You will have to make separate executables for Windows and Linux too.

Member Avatar for shadwickman
0
113
Member Avatar for wanne

You may also want to look into unwrapping, like this example: [code=python] coords = [14, 16, 4] x, y, z = coords """result --> x = 14 y = 16 z = 4 """ [/code]

Member Avatar for woooee
0
97
Member Avatar for kes_ee

Well first of all, you don't need to make an [icode]enumerate_list[/icode] class as there's already the built-in one [icode]enumerate[/icode] which you can use on lists, strings, tuples, etc. Meaning that you could use this instead: [code=python] for i, ch in enumerate(xStr): xDict[i] = ch [/code] Also, don't use [icode]str[/icode] as …

Member Avatar for shadwickman
0
129
Member Avatar for PrincessT

And as a side note, you shouldn't be using [icode]stdio.h[/icode] or [icode]stdlib.h[/icode] as those aren't standard C++ headers. Use [icode]cstdio[/icode] and [icode]cstdlib[/icode] which [I]are[/I] the standard C++ headers. And as u8sand said, you're only executing things through once. Loop until the game is over, then ask to if the player …

Member Avatar for kangarooblood
0
186
Member Avatar for tomtetlaw

[QUOTE=vegaseat;907717]Better test it, that won't work![/QUOTE] Why not? It worked for me when I tested his code... and there's nothing wrong with his binding as I added another menu item with a separate function and ID and that still worked without conflict.

Member Avatar for lllllIllIlllI
0
131
Member Avatar for nclouse

What operating system are you using? If MS Windows, you can use [icode]os.system('cls')[/icode] to clear the console window before reprinting the progress display. Yes, yes, I know that clearing the screen isn't good because a) this won't work on Mac or GNU/Linux, b) it may cause users to lose any …

Member Avatar for shadwickman
0
104
Member Avatar for balu naik

I'd definitely suggest going with G++. MinGW is the port of that for Windows. And as Ancient Dragon said, please don't go for DevC++. That died back in 2005 and so it hasn't been updated since.

Member Avatar for Ancient Dragon
0
162
Member Avatar for Your_mum
Member Avatar for vegaseat
0
129
Member Avatar for MosaicFuneral
Member Avatar for sgw

@XTRobot I know your problem's solved, but I thought I felt like saying that I'd advise against using DevC++. I used to use it, but it's been dead since 2005, so I'd use something like GCC or CodeBlocks now to keep the compiler up to date.

Member Avatar for tux4life
0
172
Member Avatar for a1eio

When you generate an .exe with py2exe it also makes other files that I think the .exe is dependent on. Like some .pyd files and such. Well, all the .exes I generated with py2exe did that for me, at least. I may have been doing something wrong though, as I …

Member Avatar for Stefano Mtangoo
0
2K
Member Avatar for salie_90

It seems you are just laying down a flat-out request for us to code you something. Not gonna happen. Post the code you have come up with so far and where you got stuck, etc. and I'll try helping from there.

Member Avatar for tux4life
0
349
Member Avatar for kes_ee

You don't really need to be using regular expressions on something this simple though...

Member Avatar for shadwickman
0
178
Member Avatar for caquake

By the way, please use code tags around your code instead of typing "Code" and "end of code". Anyways, I don't see what your problem is exactly. Don't you just need to actually code in whatever you want performed into the final function and you're all set?

Member Avatar for shadwickman
0
406
Member Avatar for kes_ee

If by each "word", you mean strictly at every space, then you could read the file line by line, and perform this on every line: [code=python] fh = open('filename', 'r') for line in fh.readlines(): # use 'xreadlines()' if the file is large and you just want an iterator words = …

Member Avatar for Lardmeister
0
808
Member Avatar for GrimJack

Alas, "shadwickman" was too long for it so I had to settle to just "shadwick". S.H.A.D.W.I.C.K.: Synthetic Handcrafted Android Designed for Worldwide Infiltration and Ceaseless Killing It gives the same for the "C.K." as you.

Member Avatar for Sky Diploma
0
116
Member Avatar for iliketacos

Well, seeing as you didn't read [this simple post](http://www.daniweb.com/forums/announcement114-3.html) about using code tags, your Python has no indentation. Brilliant. I'm not going to try to fix your code's indentation so that I can begin to help with your problem. If you can post it with those helpful tags around it, …

Member Avatar for iliketacos
0
261
Member Avatar for Your_mum

Yield is for generator functions. Return ends the function and sends back the specified value. Generators are functions that return iterators, i.e. they 'yield' a value after each iteration of them, before proceeding to the next one. This is generally used for things where you don't need all the results …

Member Avatar for shadwickman
0
174
Member Avatar for Nyaato

You can try the built-in [icode]filter[/icode] function. Here's what I tried in the interpreter: [code=python] >>> a = [ 'filter', 'lol', 'filter', 'lol', 'lol', 'filter', 'lol' ] >>> b = ['filter'] >>> c = filter(lambda x: if x in b, a) >>> c ['filter', 'filter', 'filter'] [/code] As you can …

Member Avatar for Nyaato
0
450
Member Avatar for tomtetlaw

[QUOTE=funfullson;902044]Sorry I think it will overwrite on print when its its callers prameters be like its own.or else print will call. Is it true?[/QUOTE] I believe you're thinking of overloading a function, like in C++. Python doesn't have that capability.

Member Avatar for shadwickman
0
131
Member Avatar for tomtetlaw

Well, there is no return statement at all in that function... so it would return <i>None</i>.

Member Avatar for shadwickman
0
212
Member Avatar for sravan953

sraven, this only works when the command prompt window is in focus. If you're trying to capture all input for other applications too, then you'll need to use pyHook or be able to expand on sneekula's getch() example, but I'm not sure how to make that grab key presses with …

Member Avatar for scru
0
493
Member Avatar for Jintu

PLEASE! Use code tags! If you look at your post, you realize your Python code has no indentation anymore, and indentation is a crucial part of Python. I'm not going to bother looking through your code until you edit that post and put your code in those tags to preserve …

Member Avatar for vegaseat
0
141
Member Avatar for dude93

If you look at this forum, there is a permanent thread called "Projects for the Beginner". See [URL="http://www.daniweb.com/forums/thread32007.html"]here[/URL]. It has a huge amount of projects/ideas in it, so you can start looking through it for stuff to do.

Member Avatar for vegaseat
0
114
Member Avatar for tomtetlaw

Doesn't the windows installer come with it? EDIT: for Ubuntu, it should be [icode]sudo apt-get install idle-python3.0[/icode]

Member Avatar for vegaseat
0
159
Member Avatar for hughesadam_87

Can you post some of your code? I'm confused as to why you need to hold so many files open at one time... could you just cycle them one by one and not have them all open?

Member Avatar for jlm699
0
1K
Member Avatar for pymatio

As a side note, "super" is a reserved keyword in Python already, and you named your script that. It shouldn't cause this problem at all but in the future it might raise some sort of issue if you expand on this. As for the current situation, what was the value …

Member Avatar for shadwickman
0
154
Member Avatar for gudivada213

Because when you read lines from a file, a string is returned. Your data[3] is "0833.6323" (as a string). You can just convert it to a float first before the calculation like this: [icode]latitude=str(float(data[3])/100.0)[/icode] EDIT: I noticed you signed your post "sraven". You already have an account here (under that …

Member Avatar for gudivada213
0
5K
Member Avatar for dantheman3141

I think you can have it pass the command to the computer via the [icode]os[/icode] module. Like for Debian-based GNU/Linux distros you could write: [code=python] import os os.system("halt") [/code] The only problem I can think of is that this would require super-user privileges to execute the shut down. With Windows, …

Member Avatar for dantheman3141
0
886
Member Avatar for shadwickman

If anyone is still interested in those old, nostalgic text-based games to run in the console, there's Python Universe Builder by Joe Strout. Yes, it's a dead project as the last release dates back to 2006, but it still works fine if anyone is interested. On the [URL="http://py-universe.sourceforge.net/"]Sourceforge page for …

1
116
Member Avatar for rasizzle

Got it :D [code=python] data = [['4/18/94', '29.125', '442.46'], ['4/19/94', '29.336', '442.54'], ['1/20/04', '75.175', '1138.77'], ['1/21/04', '75.711', '1147.62'], ['1/22/04', '75.595', '1143.94']] result = [] for item in data: # current middle index as a float n = float(item[1]) # if there are no items in the result list yet if …

Member Avatar for rasizzle
0
104
Member Avatar for sravan953

Threading is for running multiple things at once. Such as having a thread run to update a GUI while another performs some sort of data manipulation. So, threading is much different than what you're after.

Member Avatar for sravan953
0
270
Member Avatar for txwooley

As for a regular application, I'd go with [URL="http://wxpython.org/"]wxPython[/URL] for sure. Best GUI toolkit I've used for Python (I can't stand Tkinter at all). If you want to make it more graphics-rich and not look like a regular program, you can try [URL="http://www.pygame.org/news.html"]pygame[/URL], but that might be a bit difficult …

Member Avatar for txwooley
0
332
Member Avatar for MONODA

Expanding even further: [code=python] import random mini = 1 # min. number of tuple indices maxi = 5 # max. number of tuple indices low = 1 # low-end of range of number high = 9 # high-end of range of number result = [] for j in range(10): current …

Member Avatar for MONODA
0
10K
Member Avatar for jaypaul

Just store your data in one file for each map, simple solution. Each row is a row in the map, and each value between commas in a column: [code] 1,5,6,3,5 4,8,9,6,4 2,4,6,7,6 0,0,1,3,2 5,7,4,2,1 [/code] That could be a 5 x 5 map. Then just read the file and split …

Member Avatar for Cardboard Box
0
166
Member Avatar for karisegraves

Yeah, HTML can't do anything like that on its own, it's just a mark-up language. If you want to develop text-based games first, and have no prior programming experience, I'd suggest [URL="http://python.org/"]Python[/URL]. The syntax is simple and understandable. The one thing is that the recipient's computer needs Python installed on …

Member Avatar for shadwickman
0
108
Member Avatar for AhmedHussain

If you haven't done programming/development before, please, for the love of god, do not start trying to make 3D games. You need to learn the basic concepts first, then work your way up. And I wouldn't suggest Java for 3D games anyway. C++ would be your best bet. If you …

Member Avatar for shadwickman
0
179
Member Avatar for hughesadam_87

If you want a copy of the sorted object, instead of directly modifying the object itself, use the built-in "sorted" function. [code=python] >>> L = ['z', 'aa', 'g', 'ab', 'yz'] >>> Ls = sorted(L) >>> Ls # returned copy ['aa', 'ab', 'g', 'yz', 'z'] >>> L # original stays the …

Member Avatar for lllllIllIlllI
0
96
Member Avatar for sedampatil

Please, edit your above post and put whatever is Python code inside tags like this: [B][noparse][code=python] CODE GOES HERE [/code][/noparse][/B] Indenting is essential to Python, so your code needs to retain it in the post.

Member Avatar for shadwickman
0
196
Member Avatar for rasizzle

I'm curious why you have the lines [code]length_of_buy_list = [] length_of_sell_list = [] ... length_of_buy_list = len(BuyList) length_of_sell_list = len(SellList)[/code] You declared them as empty lists, then changed them to an integer of the list length... And also, you store these lengths at the beginning but you don't change them …

Member Avatar for shadwickman
0
316
Member Avatar for tomtetlaw

Your "items" dictionary doesn't have a key named "o" which apparently you are trying to locate. The line [icode]if p.weapon == items[sitem[1]][/icode] is basically equating to [icode]if p.weapon == items["o"][/icode]. That seems to not be in the chunk of "relevant code" that you posted, but even so, the code you …

Member Avatar for woooee
0
137
Member Avatar for Zaffron

Well, if you ran what you posted, nothing will happen. You defined these functions and classes but you haven't actually done anything with them. None of these get called during the execution of the script.

Member Avatar for Zaffron
0
103
Member Avatar for rustysynate

I haven't done this in forever, and I'm not on a linux machine at the moment, but I'll try to say what I remembered doing :P If you originally installed it using "sudo apt-get install ...." then you may have not installed any other packages it requires to run. I …

Member Avatar for rustysynate
0
176

The End.