15,190 Topics
![]() | |
I don't want to save all of my python files in the default directory, but if I save them elsewhere, python can't find the path to any modules I might be using. How can I change this to work? | |
Hello all, I have been searching for some time to find the most appropriate enviroment to draw lines and simple tri's / quads in three dimensional space. I have recently experiemented with the floatcanvas class in wxpython and I really like it for 2D work, but extending it into the … | |
Hello everyone, I am learning python from last 6 months, Just few days back i started learning Django. But at the starting only i get stuck. As you people must know that django bundle have a build in deployment server, i also used that only.. The steps which i perform … | |
Hello all, trying to get my program working. The program is to take input from the user in a hh:mmx format (x being p or a, standing for PM and AM) and tell the user how many minutes from midnight that time is. I was able to make it so … | |
I suppose I should post my question about the Twisted http server here, but correct me if I am wrong. I don't know much about python or the twisted server, but I have a project on it and I must install it in my pc. I have googled some stuff … ![]() | |
import os data = map(lambda c: ord(c), file(args[0]).read(os.path.getsize(args[0]))) For one file, os.path.getsize(args[0]) returns 10456 while len(data) returns 281. After looking at different files, I realized that it always stops reading at the 0x1A character. The documentation says that in Windows, Python uses _wfopen which (for compatibility reasons) interprets 0x1A (CTRL-Z … | |
I can't seem to see how this slice works test = (1,2,3) >>> test[::2] (1, 3) any insite would be helpful | |
How to write a function for highest denomination of any card in the hand.The denominations from lowest to highest are 2, 3,4,5,6,7,8,9,10,'jack,''queen','king','ace'.For example, highestDenomination({(6,'club'),(6,'heart'),('queen','heart'),('queen','diamond'),(2,'heart')})denotes‘queen’. | |
spring model....i want to get the program to return the value of the period of the motion of the pendulum i have tried putting this outside the loop oldVelocity = vector(0,0,0) and this inside the loop before v: oldVelocity = m.v with print statement: if oldVelocity.y/m.v <0: print ("time = … | |
This little experiment with Tkinter and pixel drawing shows some strange effects (look at line 27 comments!!!): '''tk_put_pixel.py place a pixel at pos=(x,y) with color=(r,g,b) on an image area note: one pixel might be hard to see, so create a series of pixels (line) ''' try: # Python2 import Tkinter … | |
python help on making the program accept other values? # Find the area and perimeter of a rectangle import math class Rectangle(object): """A 2D Recangle""" def __init__(self, width = 1, height = 2): self.width = width self.height = height def Perimeter(self): "Return the Perimeter of the rectangle" return (2 * … | |
TypeError: 'float' object has no attribute '__getitem__' What does this mean ??? | |
Hello, I have this functions: main(), menu1(),menu2() and so on. Main function takes an input and call one of the menu() functions so ... menu1(),menu2() functions needs to be defined before the main() function. The problem appears when i want to call the main() function inside one of the menu() … | |
I am trying to write a program to generate hailstone sequences for different starting values of n and have achieved this. Now however, I am trying to find the average length of the sequences and what the longest and shortest sequences are in the range(5,1000)and am not sure how to … ![]() | |
[B]Intro[/B] C is using structures to group data, mostly data that belongs together. Here we have some data that a campaign manager might keep for the volunteers. First we take a look at the C code: [code=c]#include <stdio.h> struct person { char *name; char *sex; char *slogan; }; int main(void) … | |
I creating a test program for TKinter, and getting some errors :( from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) self.button.pack(side=LEFT) self.hi_there = Entry(frame, text="Hello", command=self.say_hi) self.hi_there.pack(side=LEFT) username = StringVar() name = Entry(frame, textvariable=username) name.pack(side=LEFT) print name.get() def say_hi(self): … | |
Hey there, so I recently joined an online course, and the first mini-project is to create rock, paper, scissors, lizard, spock. upon testing my program it seems I've got an error in my code and I can't for the life of me figure it out, I was hoping you guys … | |
Hi, I'm in an intro to Computer Programming class, and we need to make a program that rolls 5 die, and tells you if you have any combinations (pair, 3 of a kind, 4 of a kind, 5 of a kind, and Pair+3 of a kind) My program rolls perfectly, … | |
Hi, I was wondering if there is a way to click at a certain point in the figure thats made, and make python pick up those values. So I can see the value of x f.ex in the down left corner in the figure. So my question is if it … | |
This Python Tkinter GUI toolkit code draws a shape, and shows you when and where the mouse has been clicked within the shape. | |
Hey guys, I'm in an introductory computer science class that deals with Python. We're assigned to create a dice-rolling program using Tkinter, and I have the interface pretty much down, but I'm having trouble linking it to the dice-roller. Here it is. import random import Tkinter win = Tkinter.Tk() win.title("Die … | |
I have a little problem to solve .. i have a array with x, y, z co-ordinates in it as a tuple. I am trying to find the distance between each point and sorting the points according to the min distance. Can soemone help me with the algorithm ?? | |
There is always room for optimizing primelist functions. Here is an assortment timed with Python module timeit ... | |
def CalcCentre(data): centre = array([0,0,0]) count = 0 for p in data: centre = add(centre, array(p[:3])) count += 1 centre = dot(1./count, centre) return centre | |
I am trying to run a program from python command line. I installed python on D: drive. PLZZ help me in fixing this problem. | |
hi i have been trying to draw a stick figure, but i don't know how to start, pls i need a help. | |
I am looking at python and I want to allow the user to click on the centre of the screen and create a circle, this is what I have. Any help will be very appricated. import from graphics * def blueCircle(): win = GraphWin("Click Here") p = win.getMouse() circle1 = … | |
The difference of this program from other rock-paper-scissors from is that this program ask the computer the select the weapon most likely to beat the user,based on the user's previous choice of weapons instead of using random function. #This is a program that will allow the user to play Rock, … | |
Hi, i have a 2D list in python which i'm trying to fill using 2 for loops. but the problem is when i finish the filling procedure and i print the values, i find that they are not arrangeed in the order of input. def funcdist(myarr): diffs = 0 testarr … |
The End.