15,194 Topics

Member Avatar for
Member Avatar for vegaseat

Probably the simplest way to get into multimedia with Python is the webbrowser module. This works with both Windows and Unix systems, and selects the default browser you have installed. But that is not all: if you give it the name of a multimedia file it will select the default …

Member Avatar for e-papa
4
1K
Member Avatar for Thropian

I'm trying to get sounds to play from python. I've tried Winsound, snack, and now Pygame. Winsound only seemed to play windows preset sounds (which aren't so useful), snack did nothing, and Pygame is raising a memory error on a 2 second mp3. Is there something obvious I missed in …

Member Avatar for vegaseat
0
242
Member Avatar for koveras vehcna

Hi everyone, I have created a random text generator -ok, not so random, works with certain parameters- and at times it runs slowly. I looked up on the internet about speeding tricks and applied some of them that looked concurrent with my code piece. The code however, is still slow …

Member Avatar for woooee
0
206
Member Avatar for 650U

I have a question in Inheritance(Python): Write a class named Person with data attributes for a person's name, address, and telephone number. Next write a class named Customer that is a subclass of the person class. The Customer class should have a data attribute for a customer number and a …

Member Avatar for e-papa
0
241
Member Avatar for cwarn23

Hi, I am in need of a python ocr script that can convert images into text and for the script to work on BOTH windows and centos. All the scripts I have found seem to not be compatible with linux/centos or require an api to another server and I do …

Member Avatar for cwarn23
0
167
Member Avatar for python01

Hi all, I have just modified a mouse so that the left mouse button gets activated when a puck hits the net in ice hockey... Now all I need is for python to react to the hit by sending an output of voltage for a period of time and adding …

Member Avatar for python01
0
180
Member Avatar for Thisisnotanid

Hi all, I wrote code to list primes that are in a given "radius" of an even number. For example, 6 - 1 = 5 and 6 + 1 = 7, 14 - 3 = 11 and 14 + 3 = 17, etc. I used Euler's sieve to obtain the …

0
101
Member Avatar for Stefano Mtangoo

Vega had nailed a "Starting Python" thread. I though there should be a place for proposing intermediate and advanced projects so that one can have something to do to improve their skills more. Especially for those who don't do alot of math enough to get the challenges of project eura …

Member Avatar for lrh9
0
6K
Member Avatar for Tcll

so I'm using the 'initialfile' to automatically generate the name of the import file, but I'm using 'defaultextension' to set the extension when clicking 'Save' how do I set the 'defaultextension' based on the current filter selection??

Member Avatar for Tcll
0
7K
Member Avatar for socksy

Okay, so I'm currently working my way through Beginning Python: From Novice to Professional, and I'm up to the networking stuff. I consider myself at least an intermediate Python programmer, but the network stuff is really confusing me. I'm trying to get the hang of it by writing a simple …

Member Avatar for socksy
0
210
Member Avatar for novice20

Hi all, Is there any way to do forward referencing or function prototyping in python..? Being an interpreted language, is lack of forward referencing a drawback of python?

Member Avatar for novice20
0
4K
Member Avatar for losbellos

Hej Guys, I am not a phyton programmer, just on [url]www.luxrender.net[/url] (open source project) we have this annoying problem when we need to dl something the phyton mercury doesnt pass the file size to browser... Can somebody take a helpful look at it? I am sure its just something worng …

0
45
Member Avatar for e-papa

I've tried to make a program that will sort the results of a competition, by asking the user the number of competitors, then the name and score of each one. It worked but now i have to make it recognize when two or more people get the same score (that …

Member Avatar for e-papa
0
221
Member Avatar for srw0801

Hello, so I'm fairly new to python and I have become stumped on this one problem. As much as I would like you to solve the problem for me, I do not want you to do so without explanation, I would much rather have a step by step procedure. After …

Member Avatar for srw0801
0
441
Member Avatar for Joeflims

Hey everybody. I was reading some code on the website and I saw this: [CODE]with open(FILE) as number_file: lucky_numbers = [set(line.strip().split('-')) for line in number_file] [/CODE] What does "with ... as ..." mean? What is it used for? How is it used?

Member Avatar for Joeflims
0
138
Member Avatar for Learn_Pyhton

hii..m stuck in an issue...and need a help I have Try.c file having contents ValidateFunction() { ...... ...... print } .... I want to print data between the braces {....}. Also i do not want to read the contents of file line by line because file is of very big …

Member Avatar for TrustyTony
0
154
Member Avatar for Banjoplucker

[url]http://paste.pound-python.org/show/941/[/url] Having trouble getting a loop to write to a series of newly created sequential blank .wp files. Grateful for any help, thank you. Regards & a Happy New Year! Banjoplucker.

Member Avatar for djidjadji
0
111
Member Avatar for blacknred

I have a share -//192.168.0.11/myshare which has many files in it. Which is the best way to delete all the files in this directory using python? I tried: [CODE]import os folder = '\\192.168.0.12\myshare1' for the_file in os.listdir(folder): file_path = os.path.join(folder, the_file) try: if os.path.isfile(file_path): os.unlink(file_path) except Exception, e: print e[/CODE] …

Member Avatar for jice
0
131
Member Avatar for ChaosKnight11

Hi, I am trying to install the Python4Delphi components, but it doesn't compile (from python4delphi.googlecode.com/svn/trunk). It also seems out of date. What is the best current way to use Python inside Delphi? Any advice or help will be greatly appreciated. Thanks!

0
116
Member Avatar for G_S

Hello, This is a really simple question but I just don't see the error here: [CODE]def foo(): x = input('write something: ') if x == 1 or x == 2: print('OK') else: print('NO') print(x)[/CODE] Why does it keep printing NO? Also, I have a more complicated one: def foo(x, y): …

Member Avatar for G_S
0
115
Member Avatar for kiranbkrishna

Hi all, i was writing a gui for a small desktop application i made as a part of learning python.I use python 2.7.I used Tkinter.I am new to python and this was my first trial with Tkinter. First i created 9 buttons arranged in the form of a 3*3 matrix …

Member Avatar for TrustyTony
0
370
Member Avatar for jarograv

So I have a program I am making but I need to make it more efficient, is there any way to condernse the following code into a more compact and efficient code? [CODE]r1p1=o r1p2=o r1p3=o r1p4=o r2p1=o r2p2=o r2p3=o r2p4=o r3p1=o r3p2=o r3p3=o r3p4=o r4p1=o r4p2=o r4p3=o r4p4=o r5p1=o r5p2=o …

Member Avatar for woooee
0
205
Member Avatar for TrustyTony
0
790
Member Avatar for predator78

Hello all!!! It's been a while but glad to have enough time to be back. My question is basically one of design. I'm working on a new project using pygame at the moment, mainly to brush up on and enhance some Object Oriented skills. The project itself is basically going …

Member Avatar for predator78
0
162
Member Avatar for tvks

Hello, I am a newbie in python. I have a unicode in Tamil. When I use the sys.getdefaultencoding() I get the output as "Cp1252" My requirement is that when I use text = testString.decode("utf-8") I get the error "UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-8: character maps to …

Member Avatar for TrustyTony
0
179
Member Avatar for hughesadam_87

Hey fellows, I've created a fairly large math suite for my spectrometer research, which is basically a set of programs that does several math operations, generates plots etc... It's beginning to get pretty bulky, and seems like it would benefit from a nice class; wherein, I could store all the …

Member Avatar for TrustyTony
0
121
Member Avatar for jintujacob

Hey friends lets checkout a small, simple and cute python program for taking photos with with your webcam without the help of any third party application programs. [CODE] import os import datetime import opencv.adaptors from opencv import highgui import Image def get_image(camera): im = highgui.cvQueryFrame(camera) # Add the line below …

Member Avatar for jintujacob
0
412
Member Avatar for e-papa

I wrote a program which I tested in the IDE of python 3.2, it worked but whenever I open the program directly or run from command prompt, it doesn't run correctly, after the user inputs the correct answer, the program keeps saying try again. [URL="http://www.daniweb.com/software-development/python/code/359115"]here's the program it's in the …

Member Avatar for e-papa
0
647
Member Avatar for koveras vehcna

Hello everyone, I have created my own random text generator with a custom method, no Markov chains included, and now I would like to try it on a different text corpus that is larger from that of NLTK's and I wanted to know which Data structure should I use in …

Member Avatar for koveras vehcna
0
241
Member Avatar for SakuraPink

Hi all, I'm trying to read data from this xml file that looks like this: <VEGETABLE > < FRUIT > <FRUIT name="apple">1</FRUIT> <FRUIT name="Orange">2</FRUIT> <FRUIT name="Benana">6</FRUIT> I wrote the following script:[CODE]import sys from xml.dom.minidom import parse from cmath import sqrt # Load XML into tree structure tree = parse(sys.stdin) #Find …

Member Avatar for SakuraPink
0
4K
Member Avatar for gabb810

I am trying to implement this code for hash table in python and i don't understand why i and k are not used in the while loop. Can somebody help me please, [CODE] import random data = [] m = 10 t = [] for i in range(10): data.append(random.randint(0, 100)) …

Member Avatar for vegaseat
0
219
Member Avatar for buster2209

I"m trying to determine if the user is root or not then prompt to become root user; [CODE]if os.geteuid() != 0: # If not root user... os.system("gksudo crack.py") # Open root password window else: # Do Nothing if os.geteuid() == 0: # If you are root user... os.system("You are now …

Member Avatar for buster2209
0
4K
Member Avatar for MUFC4life

Hello, my task is to create a basic game using Pygame. I decided to do the basic snake game like the one that was on all of the old mobile phones. However when inputing some of the basic code, i realised that once i have paused my game i have …

Member Avatar for griswolf
0
188
Member Avatar for Fo.katia

I have to creat a program that draws squares instead of circles. It also has to draw additional squares for each mouse click, and at the end print a message "Click again to quit" after the loop, and wait for a final clikc before closing the window. This is what …

Member Avatar for vegaseat
0
468
Member Avatar for aaronmk2

I am trying to only have the words print out if they occur the same number of times as in the fibonacci sequence. If a words show up 1,2,3,5,8 etc then it will print up. I have gotten the program to print up the words based on how many times …

Member Avatar for vegaseat
0
102
Member Avatar for bilik

Greetings all! Anyway excuse my English. I can't understand how I can do this: <loop cycle; variable is filled by some values> <loop is still running, but simultaneously another command is running> <loop is terminated; i want to read variable> More specifically (it concerned with Scapy module, but I'll explain …

Member Avatar for woooee
0
147
Member Avatar for South

For some reason it just jumps to the else statement instead of going to if and elif. Any input would really be apreciated. [CODE]a=raw_input( "What is your name: ") b= int(raw_input( "What year were you born: ")) c= int(raw_input( "What year is it now: ")) print "Hello",a,"you are",c-b,"years old." class …

Member Avatar for South
0
116
Member Avatar for ThePythonNoob

I have stated to make a program called virtual Tv, I have been having troubles with variabels and I need the variable: state to be able to be change and accessed outside the class and inside, but I think that state is a local variable at the moment. [CODE]import random …

Member Avatar for lrh9
0
211
Member Avatar for imperialguy

I want to limit the size of a list control box. Let us take the following code: [code] import wx class Students(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(380, 230)) hbox = wx.BoxSizer(wx.HORIZONTAL) panel = wx.Panel(self, -1) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT) self.list.InsertColumn(0, 'name') self.list.InsertColumn(1, 'age') hbox.Add(self.list, …

Member Avatar for richieking
0
245
Member Avatar for Joeflims

Hello. I have been trying to run a simple script in Windows 7 DOS using the python command, but it returns this error message: 'python' is not recognized as an internal or external command, operable program, or batch file. I've looked up how to fix on Google, but I can't …

Member Avatar for TrustyTony
0
773
Member Avatar for aaronmk2

For this program I am trying to figure out how to sort/print the words out based on frequency of appearance in ascending order. As of now I can only get the words to sort/print based on alaphabetical order [CODE] from collections import Counter import string while True: filename=raw_input('Enter a file …

Member Avatar for TrustyTony
0
3K
Member Avatar for ThePythonNoob

Hi guys, thanks for all the help lately, but I require some more :o I need it that the user is able to choose what is on the controller, when I type in a valid option I test for it that it gets to that point but it does not …

Member Avatar for Narue
0
83
Member Avatar for D_rOiD

I need to know how to copy some folders not all from a source tmp/folder. I'm new to python and I want to better understand python. I can't use copytree because I don't wish to copy all folders. I want to be able to pick the folders I want to …

Member Avatar for jice
0
4K
Member Avatar for Thropian

I'm looking for a simple way to rotate a shape in python, tkinter. The shape I'm rotating is a triangle (polygon) if it matters. Thanks in advance for all the help

Member Avatar for vegaseat
0
22K
Member Avatar for TechnoDarrel

Hi! i'm doing a final project for a university introduction course in web programmation. I'v Coded this: [CODE]class MainHandler(BaseHandler): def get(self): #product_comments = Comments().get_all() user = users.get_current_user() if user: member = Members().get_by_id(user.user_id()) baskets=Baskets().get_by_member(member) template_args = {'baskets': baskets} products = Products().get_all() product_comments = [] for product in products: comments = Comments().get_by_product(product) …

Member Avatar for woooee
0
227
Member Avatar for bertm81

Hey All, I have written a script that uses elementTree to work on python 2.4. Took quite a while and worked a threat but now I need to get it working on 2.3.4. I can't upgrade the version of python. Is there an equivelent version of the element tree for …

Member Avatar for bertm81
0
226
Member Avatar for e-papa

This is a simple word jumble game, I actually adapted it from one I used from practice. It's written in Python 3.1 using the pyscripter. NO modules needed.

Member Avatar for e-papa
0
673
Member Avatar for e-papa

I was just able to get PyQt4 to work on my system, and I'm now have that of python2.6, and that of python 3.2, but I have been trying to open Qt designer but all it does is just open a process in the background eating up my PCs memory, …

Member Avatar for e-papa
0
282
Member Avatar for rssk

hi all ..... [CODE]for(i=0, i<680,i++): i =m [/CODE] wen i run a program it is showing error in for loop like wen i run a program it is showing error in for loop .....

Member Avatar for griswolf
0
99
Member Avatar for shawntheking

Using both the 2011 and 2010 Fuel Efficiency .csv files, recreate the script from class allowing the user to specify the lowest gas mileage they are willing to get, list the cars available from 2011 meeting the mileage criteria, list the cars available from 2010 that meet the mileage criteria, …

Member Avatar for TrustyTony
-1
83

The End.