14,951 Topics

Member Avatar for
Member Avatar for MaxManus
Member Avatar for MaxManus
0
71
Member Avatar for besktrap

Any one know where I can find the pygame code to create a screen where you can draw simple lines by click and dragging the mouse? I know how to create lines with the pygame.draw.line(screen, (0,0, 0), (3,200), (9, 200)) script (using that as an example), but am looking for …

Member Avatar for world123space
0
310
Member Avatar for Logi.

Hi there, Ive been following a pygame tutorial from devshed ([url="http://www.devshed.com/c/a/Python/A-PyGame-Working-Example-Starting-a-Game/"]here[/url] and [url="http://www.devshed.com/c/a/Python/A-PyGame-Working-Example-continued/"]here[/url]) on making a small game to helpme get to grips with using pygame unfortunately ive ran into a little snag :< I've checked and re checked the code to make sure its as given but every time …

Member Avatar for world123space
0
159
Member Avatar for nflem

Trying to make a program that displays "Harry Verderchi" 7 times using the for-loop. With the number preceding the name like: #2: Harry .... name = "Harry" name2 = "Verderchi" for i in range(8): print "#" + "i" + ": " + name + " " + name2

Member Avatar for vegaseat
0
89
Member Avatar for Joe Hart

Hi, Below is my code. Hopefully it is in the correct format. I would like to know how to ask the user the dir and file name of certain file formats (they are red in the code) and have the program take those answers and put them into the program, …

Member Avatar for shadwickman
0
164
Member Avatar for breatheasier

Hi, I've got some c++ code(which i don't have much experience in). I'm trying to write the same code again in python but i'm not having much luck. The c++ code creates an array of x,y co-ordinates: [code=c++] for (double ix = 0; ix < nlat; ix++) { for (double …

Member Avatar for vegaseat
0
260
Member Avatar for apollo1492

im doing this code and it needs the absolute value of something here is what i have so far. the formula it gives you is x = absolute value of the square root of radius squared minus the y-intercept squared. this is the bit of code i have so far …

Member Avatar for apollo1492
0
126
Member Avatar for eyewirejets

I have a subclass with 4 attributes and a subclass with 3 attributes. I want to store my subclass instances in a list. Can I have one list for both of them or do I have to create another list because the number of attributes is different? Thanks !

Member Avatar for targ
0
91
Member Avatar for lorayyne

I can't get the math to work in this program. The 'coinflip' flips a coin until it finds either the sequence heads-tails-tails or heads-tails-heads. My issue is that when I run it, the program will perform way more trials than told, and will only account for a random few in …

Member Avatar for woooee
0
181
Member Avatar for faniryharijaona

Hi All, I've got a problem with the python class. I want to create a list of object of type obj() and link them such that the next of one object is the next in its place order. I tried this construction [code] class obj: ------def __init__(self,cargo=None,next=None): ---------------self.next = next …

Member Avatar for faniryharijaona
0
108
Member Avatar for eyewirejets

How do you call a method from the main() from a module to print base class attributes. Objects are contained in a list. Module [CODE] def show_employee(self): print 'Employee Name: ', self.__employee_name print 'Employee Number: ', self.__employee_number [/CODE]

Member Avatar for eyewirejets
0
82
Member Avatar for drfcool

Basically i'm creating a software to calculate the shorting distance between two graphs. I use dictionarys to organize this information I sort the path's as keys , each key has different paths according to the given inputs through the command: PrintByDistance. The inputs are made through the command: `insert:company:City1:City2:Distance` Company …

Member Avatar for faniryharijaona
0
236
Member Avatar for Undermine

Hello i'm rather new to Python and I was wondering how I could do a menu to prompt the user to choose a number and execute a certain part of code based on his choice. For example: please choose an option 1) 2) 3) then based on users input, it …

Member Avatar for Gribouillis
0
118
Member Avatar for Joe Hart

Hi This is my second post. I am new to python. I hope I have posted my code correctly. I am trying to have Python rewrite the compare.asc file. This file is used with another program called MUST. This is a transmission line program. This program is suppose to compare …

Member Avatar for jlm699
0
330
Member Avatar for nflem

I need helping creating a random number of "hello worlds" import random count = 0 while count < 5: count += 1 print "Hello World" dont know where to put the module

Member Avatar for nflem
0
81
Member Avatar for daviddoria

I usually make a matrix like this [code] from Numeric import * A=zeros([3,3]) print str(A[0,1]) #access an element [/code] I would like to store a pair of values in each element, that is have a matrix where the (0,0) element is (2.3, 2.4), the (0,1) element is (5.6,6.7), etc. Is …

Member Avatar for vegaseat
0
99
Member Avatar for demeryjo

[code=python] import random class gameOfLife(object): def __init__(self, columns, rows, grid = []): self.grid = grid self.columns = columns self.rows = rows for i in range(0,self.rows): sub = ['-'] self.grid.append(sub) for sublist in grid: for i in range(0,self.columns-1): cell = ['-'] sublist.append(cell) def printGrid(self): for sublist in self.grid: print sublist def …

0
48
Member Avatar for dinilkarun

Hi All, I am developing a GUI in Boa Constructor. I am using a grid for displaying some data and want to change the names of the column and row headers in the grid. Please help me in achieving this. Regards, Dinil

Member Avatar for vegaseat
0
103
Member Avatar for harsha_kusam
Member Avatar for action_owl

Can I use python to read the contents of a text file on a server and dynamically update text on a web page(based on the text in that file)? This is something that I need to accomplish but I'm not sure if python is capable or if I should be …

Member Avatar for vidaj
0
141
Member Avatar for bhanu1225

hi every one. import os from reportlab.pdfgen import canvas from reportlab.lib.units import cm c = canvas.Canvas("/Users/venkatarampey/preview.pdf") c.drawString(8*cm, 28*cm,"HELLO PYTHON") c.showPage() c.save() FILE = open("/Users/venkatarampey/preview.pdf","r") The is the python script for previewing a pdf when run. Problem here is , i was able 2 generate a pdf on mentioned path but …

0
46
Member Avatar for dinilkarun

Hi All, I would like to create new rows dynamically. When a user clicks a button, a new row should be added in the grid. Please guide me as to how can I achieve this. Thanks, Dinil

Member Avatar for lllllIllIlllI
0
92
Member Avatar for EvanPM

Ok, Is there an easy way to do this: I want to take a string and convert it to a binary string with base of my choice and convert it back. So base 2 would be 1's and 0's, etc. example: [CODE=syntax] in_string = "testing" binary_string = string2binary(in_string, base = …

Member Avatar for vidaj
0
148
Member Avatar for lorayyne

Hi all, This is a problem that has been holding me up for a while in Python. I frequently get issues relating to "global ___ is not defined" and cannot figure out what I'm doing wrong. Here is a coin-flip function I wrote: [code] def coinflip(): import random import time …

Member Avatar for targ
0
212
Member Avatar for Undermine

hi, im trying to learn python and this is giving me [ICODE]>>> x=input("Enter a value: ") if x % 2 ==0: print ("even") else: print ("odd")[/ICODE] then when i execute: Enter a number: then i enter a number but it does not print even or odd. why?

Member Avatar for Undermine
0
78
Member Avatar for Vihaio2012

Hello, I want to total up a variable that changes every time a function is run. [code]import random def flip(): h,t = 0,1 cheads, ctails, = 0,0 cflips = random.choice((0,1)) if cflips == 0: cheads += 1 return 'h' else: ctails += 1 return 't' def repeat(f,n): for i in …

Member Avatar for vegaseat
0
109
Member Avatar for lorayyne

Hello, I am trying to write a program that flips a coin until it gets the sequence "heads tails heads" and then stops and says how many flips it took to get that sequence. This is what I have so far: [code]import random import time import string def coinflip(): heads …

Member Avatar for lorayyne
0
149
Member Avatar for nonang

How do I have the algorithm below to sort my list in opposite direction (right to left) instead of left to right. Also, how do I make it sort simultaneously or alternatively in both directions? Thanks. [code=python] def bubblesort(l): for passes in range(len(l)-1, 0, -1): for index in range(passes): if …

Member Avatar for vegaseat
0
159
Member Avatar for happymadman

Is there anyway to compare lists or check to see how many of the objects in one list are the same as the other list? eg: L1 = [dog, cat, john, moo] L2 = [dog, cow, moo, stuff] there is two of the same "things" in it I'm trying to …

Member Avatar for happymadman
0
145
Member Avatar for Vihaio2012

Hello, I'm trying to write a coin-flipping program. I can get the program to produce a random coin flip result (represented as either "h" or "t") but I want to add the individual result to an ever expanding string. For example, the first result would be "h" and the big …

Member Avatar for scru
0
107

The End.