15,181 Topics

Member Avatar for
Member Avatar for James0l9l

Could someone help me write code for the game of life in python 2.6. I am a beginner to programming, and I know how to use lists and have functions from a function library that include: setupgame()- which creates a grid,state=isAlive(cell), num=countNeighboursAlive(cell)in the neighbourhood, newState=decideState(state,num) stating whether the cell should …

Member Avatar for TrustyTony
0
246
Member Avatar for pythonbegin

Dear all, I have two columns in a tab-delimited text file. I want to randomly generate a pair of entries from column1 and column2. Example - Want to randomise following pairs so that each value will have different partner after randomisation. Actually I have a very big file with 5000 …

Member Avatar for pythonbegin
0
1K
Member Avatar for pleasecompile

Hello, can someone please assist with my application... An automation system collects 512 measurement points per sensor. Each measurement point has dedicated OPC tag which I can read using OpenOPC for Python. However, with multiple sensors, the OPC server can lag. So, the automation system programmer created an "array of …

Member Avatar for pleasecompile
0
445
Member Avatar for slingblade

I'm trying to mod a python script that reads the OS X Dock plist. I've never seen python code before this and I can't seem to figure out if I'm encountering a formatting error or a syntax error or both... Here is the original code snippet, which returns a formatted …

Member Avatar for slingblade
0
158
Member Avatar for D33wakar

I used py2exe to make an executable,works fine.But even for a simple app I've got 18 other files(.pyd and dlls includinf pythonxy.dll) in the dist folder. I've heard that these files can be compressed into the executable using Gui2exe. I have Gui2exe installed already but haven't quite used it due …

0
89
Member Avatar for acrocephalus

Hello! I am using the wx.DatePickerCtrl to ask for the date using this code [CODE]wx.DatePickerCtrl(panel, -1, size=(110, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) [/CODE] However, it returns the result as [CODE]Mon 30 Aug 2010 12:00:00 AM CEST[/CODE] but I meet them to be as YYYY/MM/DD. Is there any way to do it? …

Member Avatar for vegaseat
-1
482
Member Avatar for D33wakar

I was using winsound module for the first time to use it on one of my small app,and it didn't even gave me a BEEP!. I imported winsound module first. [CODE] >>> import winsound >>> [/CODE] then [CODE]winsound.Beep(37,10)[/CODE]leads to nothing! Any kinda help is appreciated.

Member Avatar for vegaseat
0
9K
Member Avatar for redyugi

I have recently redid an earlier version of my version of Pong. However, I am having a slight issue with it. Whenever the ball hits the opposing paddle and then hits the bottom, the ball travels along the bottom until the player paddle hits it. I have tried for days …

0
101
Member Avatar for erogol

I am searching about programming languages to choose for improving myself in one of them in the way of my aims. Thus, I want to learn what is special for python and what is the general purpose of using this language, it is suitable for what kind of programs. Please …

Member Avatar for snippsat
0
142
Member Avatar for patton228

I have to add inputs just in case i have up to nine lines that i need to add feet values too. but im curious if i only have 5 lines to input is there a way to bypass the other inputs cause if i in put zero it has …

Member Avatar for patton228
0
152
Member Avatar for smohrchi

New to python and I'm trying to save and import my first modules. When I go to import my first module which I've named convert.py I receive the following error: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import convert File "C:\Python27\convert.py", line 1 Python 2.7 (r27:82525, …

Member Avatar for smohrchi
0
150
Member Avatar for dankiller94

[CODE]board = [['.', '.', '.'], ['.', '.', '.'], ['.', '.', '.']] pieces = ['X', 'O'] movetype = [0, 1, 2] turn = 0 breakgame = 0 def movecheck(): if x in movetype: if y in movetype: if board[x][y] in pieces: print 'Invalid move!' else: board[x][y] = pieces[turn] turncheck() else: print …

Member Avatar for woooee
0
175
Member Avatar for koveras vehcna

Hello everyone, I have created a text generator that acts on certain factors. I want to send every generated sentence via e-mail to a user but I noticed that everytime I send it, I encounter some problems. Below I show my code and under my code, I will describe the …

Member Avatar for koveras vehcna
0
318
Member Avatar for Beat_Slayer

Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, …

Member Avatar for Beat_Slayer
1
567
Member Avatar for abhi_cvx

Hi All, I am really new to the programming world and I am trying to solve a simple problem for my python course- I have to write a script that retrieves Columbia University's webpage and prints only the titles of the news stories on the main page. I have to …

Member Avatar for Beat_Slayer
0
280
Member Avatar for pyaru

hi, Plz can u help me find a appropriate python code for identifying various musical instruments from a given sound file

Member Avatar for Beat_Slayer
0
52
Member Avatar for rexona

hi, i'm having trouble taking say the input of the user and converting it to the right type of format i need in order to compare them. An example is say I have the number 1234 and that is assigned to the variable x and the string value of that …

Member Avatar for vegaseat
0
109
Member Avatar for debuitls

Hey guys, Trying to learn python. Anyone have any idea why this prints score_value first? ie this is the output {'score_value': 3.0, 'score_type': 1}{'score_value': 3.0, 'score_type': 4}{'score_value': 3.0, 'score_type': 5} [CODE] scores_for_bulk = [] for i in range(4): if not score[i] == 0: self.response.out.write({"score_type":SCORE_TYPES[types[i]], "score_value": score[i]}) [/CODE] Any help would …

Member Avatar for TrustyTony
0
85
Member Avatar for aidin_36

Dear All! I want to introduce a useful tool for ORMs, called Entity Extractor. It was originally wrote to use with Storm, but then it extended in a way that can be use for any kind of code generation from any kind of data-source. The main idea behind this tool …

0
41
Member Avatar for vegaseat

Compress and decompress files using the popular pkzip format and the Python module 'zipfile'. [B][COLOR="Red"]Concept Error! This code just does archiving into a zip file, no compression![/COLOR][/B] To compress and archive files it is best to use module tarfile, see the snippet at: [url]http://www.daniweb.com/code/snippet216860.html[/url]

Member Avatar for tudza
0
866
Member Avatar for bomko

[CODE]from PIL import Image, ImageDraw from random import randint picture = Image.new("RGB", (600, 600)) artist = ImageDraw.Draw(picture) for i in range(100): x1, y1 = randint(0, 600), randint(0, 600) x2, y2 = randint(0,600), randint(0,600) color = (randint(0, 255), randint(0, 255), randint(0, 255)) width = randint(2, 20) artist.line([x1, y1, x2, y2], color, …

Member Avatar for bomko
0
2K
Member Avatar for James0l9l

I want to create a list which will list coordinates on a 50 by 50 grid. I have been able to set the x-value from 0 to 49, while maintaining the y-value as 0. When I try to reset the x-value back to 0, and increment the y-value by 1- …

Member Avatar for peter_budo
0
175
Member Avatar for James0l9l

I want to create a list which will list coordinates on a 50 by 50 grid. I have been able to set the x-value from 0 to 49, while maintaining the y-value as 0. When I try to reset the x-value back to 0, and increment the y-value by 1- …

Member Avatar for griswolf
0
258
Member Avatar for pwnmercury

hello im new with python and i want to you ask a question. is there any function like switch on C++ ?

Member Avatar for vegaseat
0
233
Member Avatar for waki

Hey, i want to make a push to talk a chat, but i dont know how. [CODE]import pyaudio import sys chunk = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 44100 RECORD_SECONDS = 5 p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input …

Member Avatar for Beat_Slayer
0
186
Member Avatar for acrocephalus

Hello! How can I format a text control to show only the date in YYYY/MM/DD format using slashes? Furthermore, I would like to display a calendar icon beside it which opens an expandable calendar and sends the selected date to the text control field. This way, the user can enter …

Member Avatar for acrocephalus
-1
78
Member Avatar for lewashby

[CODE]class FooBar: def __init__(self, value = 42): self.somevar = value[/CODE] f = FooBar('This is a constructor argument') f.somevar This is a constructor argument How can the parameter value know what kind of data it's going to be given? Int, float, string, etc? thanks.

Member Avatar for vegaseat
0
121
Member Avatar for koveras vehcna

Hello everyone, I'm working on a random text generator -without using Markov chains- and currently it works without too many problems -actually generates a good amount of random sentences by my criteria but I want to make it even more accurate to prevent as many sentence repeats as possible-. Firstly, …

Member Avatar for TrustyTony
0
134
Member Avatar for koveras vehcna

Hello everyone, I'm working on a random text generator -without using Markov chains- and currently it works without too many problems. Firstly, here is my code flow: 1-Enter a sentence as input -this is called trigger string, is assigned to a variable- 2-Get longest word in trigger string 3-Search all …

Member Avatar for koveras vehcna
0
171
Member Avatar for James0l9l

I'm brand new to coding and python. Could someone tell me what is wrong with my code? [CODE] def getlist(): lst=[] answer1 = raw_input ("Would you like to add a number to create your mean value? y/n") if (answer1 == "y"): x = input ("Your number:") lst = lst + …

Member Avatar for TrustyTony
0
121

The End.