15,185 Topics
| |
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 … | |
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 … | |
| 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 … |
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. … | |
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. … | |
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] | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
| 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 = … |
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... | |
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 … | |
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 … | |
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): … | |
[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 … | |
[code=syntax] from random import randint def menu(): while True: print """ \n\n\n\n\n\n\n ____ ___ ____ _ __ ____ _ ____ _____ ____ | _ \ / _ \ / ___| |/ / | _ \ / \ | _ \| ____| _ \ | |_) | | | | | … | |
Hello again, it is me with another homework hurdle. I am currently tasked with creating a Set class. We are not permitted to use Python's set class. I have looked at Python's set class for hints, but I had difficulty understanding it. We are not allowed to add methods not … | |
This is the last lab I have to deal with before the end of the semester and I'm stuck beyond reason it really is interesting though but...so many exams and I just can't figure it out 1.The program begins by displaying the following picture in a window labeled "Original Picture". … | |
I have this program that i have been working on which plays rock paper scissors game with the user. [code=syntax] '''play a game of Rock, Paper, Scissors''' from random import randint def firstChooserWins( chooserChoice, otherChoice ): #print chooserChoice, otherChoice if (chooserChoice == "Rock" and otherChoice == "Scissors") or \ (chooserChoice … | |
Hello, If say I have 5 variables: v1=3 v2=1 v3=7 v4=6 v5=5 and two lists made from these L1=[v1, v2, v3, v4, v5] , L2= [3, 1, 7, 6, 5] and I sort on L2, so that I have, L2=L2.sort()=[1, 3, 5, 6, 7] Is there a way to sort … | |
I need to find more ftp examples, like, after logging in, performing an mget * Any pointers? Thanks. cmn | |
I have been fighting the same bug for weeks now with zero success: I am trying to get images to come up on my buttons, but they utterly refuse to show up. Regardless of whether I used my old Python 2.5.1 or now 2.6.5, the following code: [code]'''Minesweeper.''' from Tkinter … | |
Hi everyone First post but I have been browsing as a guest for help with my university python project for a while now. There some really great help on here, Thank you! Right I'm doing a beginners python programming unit as part of my uni course, and as part of … | |
If using CentOS, my Python application can call os.system, command.commands, popen, or subprocess to issue command line requests, what would be the advatage of installing and using the paramiko module for the same requests? | |
| I have a bot that connects to a server. The server code is a base class and the code that processes the data from the server is in a class which inherits the base class. I have two conditions for this assignment: [LIST=1] [*]The entire code should be runnable from … |
The End.