15,179 Topics
| |
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 … | |
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? | |
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 … | |
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 … | |
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 … | |
| |
[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 … | |
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 … | |
[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") … | |
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 … | |
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 … | |
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 … | |
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...?? | |
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 … | |
[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 … | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 … | |
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 = … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
Sorry for this post... Problem solved... had nothing to do with classes | |
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() … | |
[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 … | |
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 … |
The End.