15,175 Topics

Member Avatar for
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
398
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
100
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
104
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
110
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
150
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
Member Avatar for besktrap

hi everyone! I have two files, main.py and sprite_class.py. sprite_class.py is in a separate folder called lib. here's a quick diagram: ------------------------------------ /folder engine/ main.py /folder lib/ sprite_class.py ------------------------------------ ...sprite_class.py contains a class called Sprite: [CODE] # sprite class class Sprite(): def __init__( self, start_x, start_y, image_path ): self.x = …

Member Avatar for besktrap
0
10K
Member Avatar for leegeorg07

hi again i want to make something that captures images of my window and sove them into either a gif file or a video file, i thought about using win32s [code] win32gui.GetDesktopWindow() [/code] but i wasnt sure how to use this to save it to the file how could i …

Member Avatar for jworld2
0
107
Member Avatar for 136456

Hi every bod y I am new in programming and I like to start with pyqt but I can not find anything for learning in internet please help me how how can I write program with gt designer & when I make a form in qt how can it work(my …

Member Avatar for Ibn Saeed
0
266
Member Avatar for Dart82

Hello, Im currently writing code for a program that translates a line of text from English into German then back again. Its a big loop that needs to be executed the same number of times as words in the text. I'm almost there but there doesn't seem to be anything …

Member Avatar for Dart82
0
94
Member Avatar for gbrokaw

Hey everyone, I'm writing a program with a Tkinter GUI for my job and I was wondering whether there is a way to create an icon on my desktop to start it so I don't have to start Idle and run the program from that (computer un-savvy people will need …

Member Avatar for gbrokaw
0
135
Member Avatar for apollo1492

Im writing this program that draws a bar graph showing an investment growth. and this error keeps coming up and i cant figure it out. this is the syntax that python keeps telling me. Traceback (most recent call last): File "C:\Python26\lala.py", line 68, in <module> main() File "C:\Python26\lala.py", line 47, …

Member Avatar for apollo1492
0
137
Member Avatar for jwatte

I am embedding Python 3.0.1 on Windows, using MSVC 2008 sp1. I do not pass FILE* structs to Python, so I think compiler version differences is not a problem. The following code has a problem, in that the "txt" string that comes out at the end only contains the character …

Member Avatar for jwatte
0
356
Member Avatar for blair.mayston

Hi , Have downloaded a feed from a news site and trying to show only the first paragraph for each story. At present, the output to email looks like this: "http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun …

Member Avatar for targ
0
184
Member Avatar for hunterm

So I am trying to create a mirror image that is horizontal. I am having trouble getting the actual image to mirror because I am not sure how to go about doing this. I am using PIL 1.1.6 and Python 2.5.4, if that matters. So far I have: [code=python] def …

Member Avatar for hunterm
0
631
Member Avatar for Siaa

hello friends........ i need a program which counts the total number of galaxy stars of an image.........i think if the RGB value is less than 50.....then is wont be a star otherwise it will be detected as a star......all the clusters of the stars joined together should be considered as …

Member Avatar for Nick Evan
0
114
Member Avatar for xeo

Hi there, I need to know how to get the hard disk serial number, in windows. Thank you in advance.

Member Avatar for EAnder
0
6K
Member Avatar for rainobw

can anyone of u guyz get me out of da problem m having m sure u guyz can ... i had the python re-captcha thingy to enter the captchas on a website but now tht website has putted some code on the captchas nd re-captcha script is not working someone …

Member Avatar for jlm699
-1
265
Member Avatar for DaveF0223

I'm trying to use a DLL that I have used many times in other languages including C, Java, Perl, etc so I am pretty familiar with the library, but I didn't write it. It came from a comercial source. I'm using ctyps to load the library as such: [code] from …

Member Avatar for jlm699
0
171

The End.