15,194 Topics

Member Avatar for
Member Avatar for peppermints

So I'm trying to get it to update the score by 30 each time a fly is hit. I've tried this a number of ways, but none of them seem to be working. Here is my code (I've commented out some unneeded things so I didn't have to upload so …

Member Avatar for vegaseat
0
1K
Member Avatar for carpenoctem

Haha, still not getting the hang of this, I am afraid. I have written a script: [CODE]#!/usr/bin/env python print ("Hello, world!") name = input("What is your name? ") print ("Hello, " + name + "!")[/CODE] I have saved it as hello.py. And I try to make it executable in terminal: …

Member Avatar for vegaseat
0
313
Member Avatar for DancingDana

Hello, I've got this directory with files that contain a number in their file name. I need to check what the number is and then I need to move the file to a different directory. Right now I'm using shutil to do this, but for some reason it copies the …

Member Avatar for DancingDana
0
224
Member Avatar for sarfrazashfaq

Hi there I am translating PERL code into PYTHON Code My PERL code is if ( my $client = $dealing_clients->{ $data->{fundId} } ) And i translated it into python as if (client = dealing_clients[data["fundId"]]): But it is giving my following Error "Syntax Error While detecting Tuple" Any one know how …

Member Avatar for sarfrazashfaq
0
693
Member Avatar for carpenoctem

I am trying to run my first program/script (pardon my bad terminology, I am a newbie), and just doesn't work. I am using Ubuntu, and IDLE. and I have written: [CODE]print "Hello, world!" [/CODE] I saved the file as hello.py. Tried to click Run - Run Module, but then it …

Member Avatar for carpenoctem
0
100
Member Avatar for Archenemie

I need to make it so when i click the Do IT botton the variables ive shown take the values of the text control box ive selected, and after an hour trolling the internet and trying different lines of code i still have no clue. Does anyone have any ideas? …

Member Avatar for vegaseat
0
294
Member Avatar for Robbert

Hi, I could do with some help with how to clear a panel(self.panel1) so the new buttons load in a new/clean panel(self.panel1) in the following code when either "Button One" or "Button Two" has been selected at the top of the frame. I have tried everything I could think of …

0
289
Member Avatar for nsutton

Ok so I'm working on an address book app in python. the user writes contacts into a txt file and can search for it and everything.(run the code yourself if you want to see what it does) now for my problem, under "#if editing" i want have the user search …

Member Avatar for nsutton
0
2K
Member Avatar for leegeorg07

Hi again i have programmed a thing that asks for 2 numbers and does a series of things to it.But i want to round the square-rooted numbers to about 6 digits e.g. 5.12345. How can this be done? Here is my code: [ICODE]from math import sqrt running = 'Y' while …

Member Avatar for vegaseat
0
490
Member Avatar for SgtMe

Hi. I'm just trying to make a simple analogue clock as I learn to use TKinter with python. I need to know the maths behind calculating the x, y values for drawing the end of the hands. I don't need to post the whole program, all you need to see …

Member Avatar for SgtMe
0
970
Member Avatar for nsutton

How can i use this code (below) to take the random numbers from the dice roll and change 6 to "A" and 5 to "K" and ect. [CODE]#Poker Dice! Noah Sutton 4/24/10 import random rounds=0 #roll dice def roll_dice(): #Dice variables dice1=random.randint(1,6) dice2=random.randint(1,6) dice3=random.randint(1,6) dice4=random.randint(1,6) dice5=random.randint(1,6) '1'=9 '2'=10 '3'=J '4'=Q …

Member Avatar for Hummdis
0
4K
Member Avatar for cyon

How do I apply a function to a selective number of values in a list of lists using a list comprehension without filtering the values that are not passed through the function? Specifically, I have a list: [[4, 5, 6], [2, 4, 5]] And I want to square only the …

Member Avatar for TrustyTony
0
179
Member Avatar for Danthier

Pretty new to Python, but I have some background in C and VB. Just joined this site because I couldn't find anywhere else to get Python help! I'm working with VPython in the IDLE environment, and I'm having a problem changing a variable using a toggle switch and a function. …

Member Avatar for Danthier
0
292
Member Avatar for the_mia_team

Got this project and started with some guide, you guys think im heading in the right direction? also how would I bring up the 10 channels when the guide function is called? [QUOTE]The program always display the current mode of the Tivo: A. viewing live channel B. channel recording C. …

Member Avatar for the_mia_team
0
485
Member Avatar for joshua91

could someone please help me in forming a loop as i am stuck... [CODE] def numbergen(): randomnumber = random.randint(0,100) print randomnumber def main(): Question = float(raw_input("Do you wish to play the Guess a Number Game?(Y/N)")) for Question: if Question == N: break else: print "randomnumber" main()[/CODE]

Member Avatar for Hummdis
0
158
Member Avatar for rasizzle

Hey Guys, I'm trying to do a basic line graph here, but I can't seem to figure out how to adjust my x axis. [CODE]from pylab import * plot ( range(0,10),[9,4,5,2,3,5,7,12,2,3],'.-',label='sample1' ) plot ( range(0,10),[12,5,33,2,4,5,3,3,22,10],'o-',label='sample2' ) xlabel('x axis') ylabel('y axis') title('my sample graphs') legend(('sample1','sample2')) savefig("sampleg.png",dpi=(640/8)) show()[/CODE] And here is the …

Member Avatar for woooee
0
366
Member Avatar for pietromarchy

Hi guys, I need your help. I am using python to synchronize several c programs. For one of these programs I need a dynamic interaction. I know there are several option: I am interested in the simplest one becouse I am noob. Python code and C code have to exange …

Member Avatar for pietromarchy
0
538
Member Avatar for LarZ

Hey guys, here's a simple one: I'm developing a load test suite (for GSM networks) at the moment and i have scripts that create traffic patterns and all that. I am developing a GUI for the test suite that dynamically adjusts the layout and controls which are displayed on a …

Member Avatar for Dixtosa
0
4K
Member Avatar for Romber

Hi everyone, This is my first time here, so if I don't do everything up to how it should be done, bear with me. Anyways, for a project in my python class I am having trouble generating a webpage with clickable links. I am using Python 2.6.5 and will be …

Member Avatar for Hummdis
0
637
Member Avatar for micka10

Hello, I want to create a client in python that receives mpeg4 stream from an IP camera. I was wondering if there is any rtsp library for python that i can use to send a rtsp request to the server? I'm just starting to learn python, so your help is …

Member Avatar for Hummdis
0
117
Member Avatar for Romber

So what I am trying to do is give a user 4 links of stories that are relating to the topic. (In my specific case, they choose microsoft and I return them 4 top stories about the company). My problem is pairing the description with the link. So far, this …

Member Avatar for Hummdis
0
142
Member Avatar for NotWorking

Hi all, Having some trouble with running a command via Subprocess.Call The error: [TEX]File "/usr/lib/python2.6/subprocess.py", line 470, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python2.6/subprocess.py", line 621, in __init__ errread, errwrite) File "/usr/lib/python2.6/subprocess.py", line 1126, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory [/TEX] Everything works great …

0
43
Member Avatar for daviddoria

I am trying to strip a prefix from a string, e.g. turn [code] VTK/Examples/Test [/code] Into [code] Test [/code] Sometimes the string does not contain the prefix, in which case I would expect nothing to happen. However, [code] >>> S="Main Page" >>> S.strip("VTK/Examples/") 'Main Pag' [/code] You can see that …

Member Avatar for woooee
0
155
Member Avatar for jazzvibes

Hi all, I think I have a fairly basic question. I have a matrix and I would like to find the eigenvalues and eigenvector. In both MatLAB and Python (pylab) I can use the eig() function. Can anyone explain the reason for the differing answers? [CODE]MatLAB Code >> A = …

Member Avatar for Gribouillis
0
2K
Member Avatar for zzstore

Hi, Forgive me if this is a silly question as I am newbie to python. I have to pass a string that contains a few spaces to a python script. How can I get it to read as one argument? Thanks...

Member Avatar for Gribouillis
0
412
Member Avatar for camigirl4k3

these are my instructions: [url]http://tinman.cs.gsu.edu/~raj/2010/sp10/lab6.html[/url] this is what I have so far: [CODE] from myro import * from random import * def moveCell(pic1,cell1,pic2,cell2): x1 = 240*((cell1-1)%3) y1 = 240*((cell1-1)/3) x2 = 240*((cell2-1)%3) y2 = 240*((cell2-1)/3) for i in range(240): for j in range(240): pix1 = getPixel(pic1,x1+i,y1+j) r,g,b = getRGB(pix1) color …

Member Avatar for jcao219
0
202
Member Avatar for python.noob

Hello Friends, I'm using PyQt 4.9... I want to have an IDE with code completion to work with Python and PyQt (since we are storing both the codes in a single file with .py extension).. Once i've tested eclipse and pydev plugin.. It was pretty good to work with.. Shall …

Member Avatar for MikaelHalen
0
1K
Member Avatar for nickles

Hi, I was wondering how to write code that allowed a user to input a mathematical expression for evaluation. For example, I've written a simple method that calculates Riemann sums. [CODE]def riemann(hgLoc, a, b, intervals): sums = 0.0 size = float(b - a) / intervals for i in range(0, intervals): …

Member Avatar for TrustyTony
0
221
Member Avatar for pythonnewbie10

[code=syntax] '''calculate the future value of an investment after 10 years''' def calcValue( initialValue, interestRate ): period = 10 investmentValue = initialValue for i in range(period): investmentValue = investmentValue * ( 1 + interestRate ) return investmentValue def main(): principal = int(raw_input("Enter initial investment amount: ")) interest = float(raw_input("Enter interest …

Member Avatar for TrustyTony
0
75
Member Avatar for pythonnewbie10

[code=syntax] from random import randint def menu(): while True: print """ \n\n\n\n\n\n\n ____ ___ ____ _ __ ____ _ ____ _____ ____ | _ \ / _ \ / ___| |/ / | _ \ / \ | _ \| ____| _ \ | |_) | | | | | …

Member Avatar for TrustyTony
0
180

The End.