15,179 Topics

Member Avatar for
Member Avatar for kuchi

We have a module called "cart.items" and imported this in another PY code to use classes. I did import classed under cart.items like ("from cart.ltems import Items") and used Items class in my code. When I run my PY code in UNIX box, I get that problem. What I ve …

Member Avatar for richieking
0
556
Member Avatar for Thropian

I'm making a little game and I can't get button bindings to work. Here is what I have so far [CODE]def forward(event): print "up" frame.bind("<Up>",forward)[/CODE] but pressing the up arrow does nothing...is there something I missed?

Member Avatar for TrustyTony
0
147
Member Avatar for convoluted

Hello all. I'm trying to get a video feed in a wxPython GUI (under MS Windows) and thought about using OpenCV. There is a short tutorial on how to achieve this at this page: [url]http://opencv.willowgarage.com/wiki/wxpython[/url] (updated late 2009). The problem I'm having is trying to load the libraries to get …

Member Avatar for convoluted
0
379
Member Avatar for TrustyTony

Here another small snippet of mathematical nature returning all possible divisors of number. (set is, by the way, needed because of perfect squares Not possible to edit the snippet part but here the same with less stupid command line interface (not repeating the loop): [CODE]def divides(n): return sorted(set(sum( ([x,n/x] for …

Member Avatar for TrustyTony
1
849
Member Avatar for sneek

Hi, I read the Python/C-API and they say I should not use PyArg_Parse() anymore but use PyArg_ParseTuple(). My problem is that I retrieve an PyObject * out of PyDict_GetItem(...) so this is a single object and not a tuple. PyArgs_Parse() is the only API-Function to get a C-"string" out of …

Member Avatar for Gribouillis
0
2K
Member Avatar for kur3k
Member Avatar for richieking

[B][COLOR="Red"]IS ANYONE INTERESTED IN THIS APP???[/COLOR][/B] I am looking for guys 1 or 2 to write some open source application in python. We will decide what app. we want to write. 1.App in GUI (wx) 2.The app will have its dedicated website. 3. The app in multi platform And other …

0
102
Member Avatar for jgritty

I'm not a huge contributor on these forums, but I do read a lot. Anyhow, I have "completed" a couple things I've been working on in the last couple weeks, and thought I would share. [url]https://bitbucket.org/jgrigonis/mortgagecalculator[/url] A simple mortgage calculator written in python using tkinter that lets you calculate any …

0
73
Member Avatar for singlem1905

[I][CODE]execfile('comp1.py') def exefi(name, locals=None, globals=None): exec compile(open(name).read(), name, 'exec') in locals, globals exefi('comp1.py')[/CODE][/I] it can execute successfully. but [I][CODE]#execfile('comp1.py') def exefi(name, locals=None, globals=None): exec compile(open(name).read(), name, 'exec') in locals, globals exefi('comp1.py')[/CODE][/I] it come with "File "comp1.py", line 39, in <module> ex=c.end() File "comp1.py", line 17, in end return compile(string.join(self.code, "\n"),"<code>","exec") …

Member Avatar for singlem1905
0
117
Member Avatar for Safia Abdalla

I have been working on this simple text editor using Python 3 and Tkinter. This is my first time creating a program with an actual GUI and I have relied only on Tkinter documentation. I managed to create a text editor. However, we I started working on the commands of …

Member Avatar for TrustyTony
0
451
Member Avatar for victordq

Hi guys, Can anyone help me to fix my code so I don't get the unexpected unindent error? The code is very big, so I'll only post a small part so you can help me. I'm using the PyScripter IDE. [CODE]def pegar_dados_serial(): ser = serial.Serial(port='COM4', baudrate=115200, timeout=2) #Rotina para leitura …

Member Avatar for richieking
0
3K
Member Avatar for keltik

Hello, First of all: I'm more used to java, but at university we need to code something in python. I'm having serious problems filling a python-list with values. [CODE] for i in range(self.num_of_players) : self.player_hands[i]=["Testcard"] [/CODE] I want to fill the i-th player_hands-list with a String! Yes i declared a …

Member Avatar for keltik
0
172
Member Avatar for knan

We know that 0.1 + 0.1 + 0.1 - 0.3 = 0.0 But in python 0.1 + 0.1 + 0.1 - 0.3 = 5.5511151231257827e-017 Is there any way I can get 0.0...??

Member Avatar for knan
0
196
Member Avatar for HoneyBadger

Guys I wrote a program that creates 23 random numbers(birthdays) and the counts how many duplicates are there. How come [B][U]sometimes[/U][/B] when I run this it returns "None"? Here is the code: [CODE]import random #Checks for duplicates. def has_duplicates(userstring): userlist = list(userstring) list_len = len(userlist) len_no_duplicates = len(set(userlist)) if list_len …

Member Avatar for richieking
0
98
Member Avatar for Sykee

[CODE] import subprocess import os def main(): quickfile = file_existance() quickdraw = subprocess.Popen(['java', '-jar', quickfile],\ stdin = subprocess.PIPE, \ stdout = subprocess.PIPE) event = WindowEvents(quickdraw) def file_existance(): filename = raw_input("Please enter the location of quickdraw: ") while (not os.path.isfile(filename)): print "That file does not exist, try again" filename = raw_input("Please …

Member Avatar for WildBamaBoy
0
247
Member Avatar for Banjoplucker

Hello, I'm new here, so please be gentle. I have posted my code at the following page: [url]http://www.bpaste.net/show/11397/[/url] In short, I need to read in my file, block by block, but have the re.finditer regular expression report the offsets relative to the beginning of the overall file, rather than relative …

Member Avatar for Banjoplucker
0
106
Member Avatar for tottletj

Basically I've looked everywhere for help with this problem and been unable to find any so i thought i'd ask here. I have a text file full of numbers which i wish to manipulate. the actual text file has about 200 rows and 10 columns, but in this example i'll …

Member Avatar for Gribouillis
1
101
Member Avatar for Archenemie

Ive made this quick program to strip the "youtube - " prefix off my mp3 collection, so i started modifying a script i had made before to replace file names with a <filename><incrementing number> type name. It has gone well so far, with the only problem being it will strip …

Member Avatar for Archenemie
0
2K
Member Avatar for Arbolito

Hey guys. I'm working on a simple hangman program. I got the core engine down working in a command prompt, and now I'm making it using classes and a GUI. I'm using tkinter. Anyway, everything works with no error, but the image is not displaying at all. Here is the …

Member Avatar for KWL
0
1K
Member Avatar for n3red

Hi, I need two functions one that checks if the inputed number is a prime number and second one that splits the given number in to prafactors. I have the first function done but the second one is a bit annoying. The function has to take the given number and …

Member Avatar for TrustyTony
0
479
Member Avatar for wolvo

Hi everyone I have been given a python code to add some functionality in it. The problem am facing is that the original developer has hard coded 3 variables a,b,c in the code and these variables are before class definition in files: hers is the code snippet: [code] a = …

Member Avatar for Gribouillis
0
135
Member Avatar for WildBamaBoy

I know this is probably overly simple but I am terrible with math. This is a section from a game I'm attempting with PyGame. Instead of using pixels for coordinates I have my own render function that uses blocks(actually just cnverts block value to pixels), which are 32x32 pixels, so …

Member Avatar for Gribouillis
0
2K
Member Avatar for DocBreen

[CODE] bif="bg.jpg" mif="ball.png" import pygame, sys from pygame import * pygame.init() screen=pygame.display.set_mode((420,300),0,32) background=pygame.image.load(bif).convert() mouse_c=pygame.image.load(mif).convert_alpha() while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() screen.blit(background, (0,0))[/CODE] [quote=error] Traceback (most recent call last): File "C:/Documents and Settings//Desktop/Programming/PYGAME TEST/pygame.py", line 4, in <module> import pygame, sys File "C:/Documents and Settings//Desktop/Programming/PYGAME …

Member Avatar for IceLee
0
109
Member Avatar for Batric

Hi everyone, I am trying to get Python working on XAMPP. I'm running Windows Vista, XAMPP version 1.7.1., PHP is working without any problems. I followed the instructions from here: [url]http://www.macouno.com/2010/03/17/getti[/url] ... -on-xampp/ I did everything the same, restarted Apache service, rebooted the PC but still I get the following …

Member Avatar for Batric
0
612
Member Avatar for Brickmack

I was wondering how to make a sound play repeatedly in python. I'm making a simple alarm clock program, and at a certain time (6:30 for example) it will play a recorded sound over and over again until the user presses enter. I think I have that figured out, but …

Member Avatar for woooee
0
77
Member Avatar for convoluted

Hey all. So I'm attempting to include mouse gestures as a part of a GUI I'm designing. I'm using the following code, and it works great HOWEVER only when the gesture is draw away from widgets/controls (such as buttons, statictext's, etc). If I start a gesture and cross the path …

Member Avatar for richieking
0
173
Member Avatar for keltik
Member Avatar for Gribouillis
0
78
Member Avatar for bmoe

What is the best way to terminate ReadFile once the data is done being read? I just sits there an hangs! I'm kinda new to Python so be easy on me! :) The other way i was able to read info from my pipe was blah = open(pipe) then blah.read() …

0
118
Member Avatar for parijat24

[CODE]dict = {'ENSTRUT00000047813': '1680', 'ENSTRUT00000047812': '2067', 'ENSTRUT00000047811': '2067', 'ENSTRUT00000047810': '2088', 'ENSTRUT00000047814': '738', 'ENSTRUT00000047808': '2208', 'ENSTRUT00000047809': '2001'}[/CODE] I want to find out the key with max value from the dict I am using the [CODE] protein = max(dict.iteritems(),key=operator.itemgetter(1))[0][/CODE] but it will give me results as [CODE]'ENSTRUT00000047814'[/CODE] though i know that it …

Member Avatar for TrustyTony
0
170
Member Avatar for python_user

Can anyone please help me as i am new to python, i have a requirement for a cascaded menu(which should be dynamically built). The cascaded menu should have new at all levels and when the user clicks on new it should ask for keyword and when done it should add …

Member Avatar for richieking
0
162

The End.