15,175 Topics

Member Avatar for
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
8K
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
317
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
257
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
Member Avatar for n.utiu

Few days ago I finished making my own (quite primitive) chat server with SocketServer. I haven't had any problems with it apart from the designing of the chat protocol: I made a very sketchy protocol for messaging. The client just sent unix-like commands to the server to do certain opperations: …

Member Avatar for n.utiu
0
113
Member Avatar for rexona

Hi, I am trying to generate a list of random numbers where each number in the list is a individual string. This is my code so far: [CODE]import random def make_secret(numdigits): a=[] secret = random.sample(range(0, 10), numdigits) for i in secret: a.append(str(secret)) return a[/CODE] An example of what i'm trying …

Member Avatar for snippsat
0
182
Member Avatar for Xzarik

Okay i'm really sorry to have basically bombarded this forum but this is my last cry for help on this project I swear! I guess many of you are intimately familiar with what's happening so far, and thank you all so much for putting up with me =) I've got …

Member Avatar for TrustyTony
0
134
Member Avatar for Xzarik

Yet another thread showing how awful I am at programming... I've got a list called week_pattern It contains a list of 52-character strings which represent whether something occurs in a certain week. The list is below: [CODE]['0000000000111111111100000000000000000000000000000000', '0000000001000000000000000000000000000000000000000000', '0000000000000000000000000011111111000011100000000000', '0000000000000101111100000000000000000000000000000000', '0000000001111111111100000000000000000000000000000000', '0000000000111111111100000000000000000000000000000000', '0000000000000000000000000001111111000001100000000000', '0000000000111000000000000000000000000000000000000000', '0000000001111111111100000000000000000000000000000000', '0000000000000000000000000011111111000011100000000000', '0000000000000000000000000011111111000011100000000000', '0000000000000111111100000000000000000000000000000000', '0000000000000000000000000000000000000000001000000000', '0000000000000000000000000001111111000001100000000000', …

Member Avatar for Xzarik
0
113
Member Avatar for dj343

Hello, I'm trying to install a python based program, the instructions call for this command. I have python 2.7 installed & have successfully installed virtualenv using easy_install CODE_DIR=`pwd`/program PYTHON_BIN=/opt/python-2.5/bin/python VIRTUALENV_BIN=`dirname $PYTHON_BIN`/virtualenv $VIRTUALENV_BIN $CODE_DIR cd $CODE_DIR source bin/activate I try to run just the first line and I get this: Traceback …

Member Avatar for snippsat
0
114
Member Avatar for student_

this error keeps plaguing me with the code: [code=python] option = input('What would you like to do? ') if option == 1: newExpence = addExpence(totalBudget) totalBudget = totalBudget - newExpence elif option == 2: removedExpence = removeExpence(totalBudget) totalBudget = totalBudget + removedExpence elif option == 3: newRevenue = getNewRevenue() totalBudget …

Member Avatar for snippsat
0
133

The End.