15,181 Topics

Member Avatar for
Member Avatar for crackers

Im writing a game of scissors paper rock and have come up with this so far, but i cant get it to work. any idea's where ive gone wrong. print \ ''' a - Rock b - Paper c - Scissors ''' choice1 = raw_input("Choice: ") print if choice1 == …

Member Avatar for ZZucker
0
140
Member Avatar for unzzi

I have been looking for a good plugin system for a while. I've found a few but they don't exactly match my needs. I wouldn't want to go ahead and reinvent the wheel (I'm sure someone has already done what I need). What I'm looking for: Plugin system that lets …

0
42
Member Avatar for patrick91

hello I've this python code: [CODE=python]import wx class MyFrame(wx.Frame): def __init__(self, parent=None, id=-1, title=None): wx.Frame.__init__(self, parent, id, title) self.panel_1 = wx.Panel(self, -1) self.panel_1.Bind(wx.EVT_PAINT, self.on_paint) self.image = wx.Image('foto.jpg') # Menu Bar self.frame_1_menubar = wx.MenuBar() self.File = wx.Menu() self.Test = wx.MenuItem(self.File, wx.NewId(), "Test", "", wx.ITEM_NORMAL) self.File.AppendItem(self.Test) self.frame_1_menubar.Append(self.File, "File") self.SetMenuBar(self.frame_1_menubar) # Menu Bar …

Member Avatar for patrick91
0
219
Member Avatar for oldSoftDev

hi I am a beginner python user studying python is fun and i have learned many thing now a days I am working on a program to find prime numbers and non prime number in a list generated by range function. i am done with my work the problem is …

Member Avatar for jrcagle
0
98
Member Avatar for roulette843

I want to create a method in Python that will read all of the text on a webpage and put it into a text file. Eventually I will have it distinguish between hyperlinks by having it exclude lines in the text containing href="....." Any help would be greatly appreciated.

Member Avatar for vegaseat
0
3K
Member Avatar for Chunkymonkey

Hi everyone, I'm new to daniweb and seems cool there are alot of nice helpful people on here. With my dad we are trying to script a simple poker game on python(and tkinter). There are 4 players ( 1 real and 3 artificiel intelligence players), each AI should be able …

Member Avatar for Chunkymonkey
0
178
Member Avatar for Mackjan

Hi I try to copy a list to another list but it dosent work[code] def kopi(x,y): i=0 for i in range (1,len(x)-1): x[i]= y[i-1] i+=1 print y [/code] I dont know what is the problem with my code. thanks alot for your help.

Member Avatar for vegaseat
0
107
Member Avatar for FreezeBlink

Hey. I'm working on a simple project that requires a way to find all the empty grid cells accessible along a path that's <= n cells long (an analogy would be TBS movement), and I've got an [i]almost[/i]-working piece of code for it. Here's the function I wrote: [code=Python]def findArea(distance,origin,gridUsed,emptyChar): …

Member Avatar for vegaseat
0
139
Member Avatar for Micko

Hi to all, after two months I decided to give Python one more chance. Here is a little code snippet about counting number of words in text file. (Under word I assume any combination of letters and numbers delimited by standard separators " .,\n\t" [code] file = open ( "Test.txt", …

Member Avatar for vegaseat
0
5K
Member Avatar for Azurea

Hi guys, I have a simple question. I'm trying to import my modules from a different folder (the different folder is in the same place as the the program I'm importing from), but I don't know how. I've looked on Google, but I've had no luck so far. My question …

Member Avatar for Azurea
0
84
Member Avatar for CFrances

I'm new to Python and I'm working on a craps game. I got the basic code down, but I need to simulate a total of 200 games and track the number of wins. I need a counter in my program, but I can't figure out how to do this. Here's …

Member Avatar for CFrances
0
3K
Member Avatar for Munki87

I'm currently creating a text based adventure game using python. One of the features in the game is that when you enter a room an enemy attacks you and takes off some of your health. I have an If loop to control if there is an item that you need …

Member Avatar for jrcagle
0
87
Member Avatar for eemqjunk

hello, i'm a newbie programmer (and to python, double trouble :) and running into issues reading and writing files. i'm successfully running the code below to manipulate and remove the first few lines of a text file. The text file (file1.txt) is approx. 329kb but when i run the code …

Member Avatar for ZZucker
0
90
Member Avatar for ChrisP_Buffalo

I'm a linguist (Python newbie) trying to use Python to help me with some simple NLP processing. I have extracted verb + preposition + VBG triples from the British National Corpus, so I have large csv files containing stuff like this: plan,on,selling criticised,for,getting opened,after,receiving were,in,identifying visited,before,returning recruited,from,including attended,by,including given,by,joining ... …

Member Avatar for woooee
0
89
Member Avatar for majestic0110

Hi all I am brand new to python so if anyone could help that would be great. The trouble I have is that I am trying to call two other programs from within a parent program, and pass arguements to these children programs. Here is my code so far, but …

Member Avatar for Ene Uran
0
126
Member Avatar for urmybaby

Enter initial capital: 2000 Enter percentage: 6.6 Enter number of years: 4 After Year 1 you’ll have 2132.0 dollars After Year 2 you’ll have 2272.71 dollars After Year 3 you’ll have 2422.71 dollars After Year 4 you’ll have 2582.61 dollars In 4 years, a total interest of 582.61 dollars is …

Member Avatar for Ene Uran
0
129
Member Avatar for Stefano Mtangoo

I don't know where to put quit.png. This result in errors. Is it put on SPE folder or somewhere in python? or Just in same directory as saved file? I appreciate your help! Steve Code import wx class MyFrame(wx.Frame): def __init__(self,parent,id,title): wx.Frame.__init__(self,parent,id,title,size=(700,600)) toolbar=self.CreateToolBar() toolbar.AddLabelTool(wx.ID_EXIT,'',wx.Bitmap('..\icons\quit.png')) app=wx.App() MyFrame(None, -1, 'Simple Toolbar') app.MainLoop()

Member Avatar for Stefano Mtangoo
0
242
Member Avatar for kryptolite

Hi, I am new to phyton and now I have some problems in terminating my while loop. This loop runs infinitely, I tried to print both count and N and yes, the value of count does go way beyond N but the loop is never terminated. I am guessing this …

Member Avatar for BearofNH
0
61
Member Avatar for urmybaby

2. List Processing (10 Points) Write a program that asks the user to enter a list with an even numberof integers. The program then has to construct a new list by adding pairs of integers in the list. Hereis an example of a program run, where the user enters the …

Member Avatar for jaux
0
177
Member Avatar for dilbert_here00

Hi All, Is it possible to flush the buffer of "popen2.Popen3(cmd)"after some time interval? I am starting a server forever using the popen2 module. After some time the buffer gets full & it stops logging messages. As a workaround to this, I am redirecting the output of 'cmd' to a …

Member Avatar for dilbert_here00
0
118
Member Avatar for sanoski

I recently bought a book on Python, and I'm working my way through it. However, I've come to a very simple program, but I can't understand a certain part of the code. Can someone explain? [QUOTE]# Print out a date, given year, month, and day as numbers months = [ …

Member Avatar for sanoski
1
263
Member Avatar for nsandestin

Is there something similar to a LIKE function in python? What I'm trying to accomplish is to search inside a string, if it finds specific criteria it sets another variable to a specific value. In other scripting languages I have used a LIKE function to do this but I can't …

Member Avatar for nsandestin
0
119
Member Avatar for linux

Essentially, what I want to do is get rid of MIDI files, when creating a sequencer. So, say I have a text file (that would be my pseudo-MIDI): [code]A |----------------| Bb |----------------| C |----------------| Db |----------------| D |----------------| Eb |----------------| E |----------------| F |----------------| Gb |----------------| G |----------------|[/code] As that …

Member Avatar for Ene Uran
0
81
Member Avatar for wyno

hi there, my 1 year old carpet python is eating a jumbo rat every 3 days wat is the next thing to feed after jumbo rats please advise thanks wyno

Member Avatar for Ene Uran
0
85
Member Avatar for heshan

I am using java.util.map to store some data ( one key and two values , per row ) in java and return it to a python function . What kind of a data structre should I use in python to catch it? (btw I am using Jython as a bridge …

Member Avatar for bumsfeld
0
54
Member Avatar for Foobar69

Hello everyone! This is my first post here, so, hi. ;) So I'm beginning to port (actually, re-write) one of my C games to Python to extend my Python knowledge, using wxPython. Yes, I know of PyGame, but I really want to use wxPython this time. I'm guessing direct pixel …

Member Avatar for bumsfeld
0
62
Member Avatar for blaze423

I'm a relatively new Python programmer, but I have all the basics down. Currently I'm working on a program that sends and receives serial input and receives video input. I have gotten this to work in a basic command prompt structured code however I want to be able to implement …

Member Avatar for a1eio
0
225
Member Avatar for timo_81

Hi, I wanted to ask if somebody could help me on the following problem: I want to check how often a button in python/tk is clicked. I tried the folowing but it doesn't work: [code=python] click=0 def button_clicked(): click=click+1 print click [/code] but this won't work because the variable click …

Member Avatar for timo_81
0
172
Member Avatar for tico

I'm new to creating python extension modules with distutils. I'm trying to create a module that uses the fmodEx audio library on OS X, and I'm running into some trouble. The needed library file is called fmodexlib.dylib. My setup.py looks like this: [CODE] from distutils.core import setup, Extension setup(name='test', version='1.0', …

Member Avatar for woooee
0
96
Member Avatar for heshan

Hi, If I execute the following code I will get the the output as 2. What I need is to execute the string str. Is there a way that I can execute the string str , as it is so I will get the output as 5. [ICODE] def add(a,b): …

Member Avatar for Ene Uran
0
107

The End.