15,181 Topics
| |
I'm trying to compile the following pygame code: [CODE]import sys, pygame pygame.init() size = width, height = 320, 240 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size) ball = pygame.image.load("ball.gif") ballrect = ball.get_rect() while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() ballrect = … | |
Hello everyone....... i need to display the html and php page on the tkinter window...is that possible to create a frame or canvas, which work as a php html interpreter.......... to fetch html i can use urllib module, i think... Thanks .... | |
Hi, I was wondering if Perl has a command line interpreter like Python's IDLE, where you can test things readily without having to save them as a program and run them. If not, why? Why is it that Python or Matlab has command line interpreters where you can type 4+3 … | |
...hello!!!...I need some help in python... ..Im new to Python programming and I need a window form builder that can script it into a python program....can you please give me suggestions.???..I have tried also searching on google but Im afraid the results might not help me well....unlike asking here at … | |
i finally started having a look at gui yesterday, and tried to do some things with PySide, however i have the following problem; Whats wrong with this code? [CODE] !/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide.QtCore import * from PySide.QtGui import * class Form(QDialog): def __init__(self, parent=None): … | |
Hey guys, I'm looking for a python library that can. 1. Act as a simple paint editor. 2. calculate top, bottom, left, right most points of a picture I'm trying to make a simple handwriting recognition software based on the number of permutations possible for simple endpoints. Example: psudocode for … | |
Hi Guys, Can anyone help me redo this, so it'll be a list comprehension instead? def parseAnnotation(annotation): ExonStartAndStop = [] d = annotation.split(',') for i in d: removeparenteses = i[1:-1] numbers = removeparenteses.split('..') ExonStartAndStop.append((int(numbers[0]),int(numbers[1]))) return ExonStartAndStop example usage: print parseAnnotation('(1834..2736)') ---> [(1834, 2736)) | |
| my text file content looks sth like this: -title info~~~~ ~~~~~~~~` ~~~ -tittle info~~~~ `~~~~`` and so on.. the no of line in the info section is not constant. i want to pick the data with the right title and save it in another file i'm guessing i need to … |
Hello i made a phonebook script on python. I am quite new and have been only learning for less than a day and i cant get it to save the entered phonenumbers (is resets to default everytime you quit) Please help me with the code please! [CODE]phonebook["test"]=12345678 def searchname(): print … | |
there is a simple code,which can run locally ,and get three csv file in c:/ #coding:utf-8 import urllib import re import os exchange=['NASDAQ','NYSE','AMEX'] for down in exchange: myfile=open('c:/'+down,'w') url='http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange='+down+'&render=download' file=urllib.urlopen(url).read() myfile.write(file) print 'ok',down myfile.close() i want to upload it onto my google app (i have one google app account)and let … | |
ive been working on this script as a project, and when i run it and click on the button to sleep(its going to be an rpg game) it loops and sends the command a bunch of times through the function. [CODE] import sys, random, time, pygame from pygame.locals import * … | |
[CODE]import urllib2 from BeautifulSoup import BeautifulSoup data = urllib2.urlopen('http://www.NotAvalidURL.com').read() soup = BeautifulSoup(data) table = soup("tr", {'class' : 'index_table_in' }) print table[0][/CODE] the result is: <tr id="index_table_12345" class="index_table_in"> <td><a href="/info/12345">string 1</a></td> <td><a href="/info/12345">string 2</a></td> <td><a href="/info/12345">string 3</a></td> <td><a href="/info/12345">string 4</a></td> <!--td></td--> </tr> *the goal is to get only the strings and … | |
just making a thread that will hopefully stick for a while... >_> I just need a little help and need to know a few things before starting on this... the main thing being the need to know how to build a good update system >_> my program will have a … | |
[CODE]# 619480 import time from random import * def main(): lst = [] result, length = 0, 500000 while result <= 0.50: for i in range(length): lst.append(randint(1, length)) value = randint(1, length) t0 = time.clock() linearSearch(value, lst) result = time.clock() - t0 print("This LINEAR SEARCH took {0:4.2f}seconds with a length … | |
While looking into [URL="http://www.had2know.com/academics/gaussian-prime-factorization-calculator.html?blankone=2&result="]Gaussian primes [/URL]I came to think additional ways to check for is number integer or not, what you think is best way? [CODE]epsilon = 1e-11 def is_integer(n): """ traditional abs, epsilon check for near integer """ return abs(n-round(n)) < epsilon def is_integer2(n): return (float(n)- int(n)).as_integer_ratio()[1] == 1 … | |
This is very basic issue with me right now. I don't know how to write a function or class in python. I mean i know the syntax but i don't know how to escape from the indentation while typing on IDLE. For example [CODE]def sum(): var1=10; var2=20; sum=var1+var2; #how to … | |
Can someone tell me, step by step, how python interprets this code? [CODE] Numbers = [1,2,3,4,5,6,7,8,9,10] Numbers[8:3:-1] [/CODE] I know that the "-1" is the counting bit of it, and it goes in the negative direction, but I'm lost on everything else... :( | |
can someone please look over this code and see if they can make it run faster. if you make any changes will you comment it so i can see what you did. this is a personal project. thanks you very much [CODE]#Image manipulation library from PIL import Image import datetime, … | |
Title says all. I need to make a code that gives the prime factorization of a number and put them in a (this is important) a list. | |
Hi, I want to iterate over a list, printing each item and subsequently deleting it, so that at the end, the list is empty, while all the numbers are printed out. I have tried two tactics (to me the logic for both is the same, just checked to spot the … | |
Hello and good afternoon. I'm new to python an Tkinter. My task : a triggered camera writes 12 images every 70 seconds in a specific folder. The newest 12 images should be visible in a frame at 12 labels ( labels are able to display images ? ). I made … | |
What i want to build is this: Sending a command to another computer and get the results back on the computer where i started on. Additional info: I have a web server running with python on 192.168.10.100:5000. When i go to this address i get a web page and on … | |
Hey all! I have some questions about pythons capability of processing video fails. I would like to run and edit some files with pythhon. Can i use pygame or wxPython or do i need some other libaries? And does somebody have some example codes or helpful materials of video processing? … | |
Version 2.6 of wxPython has support for playing animated gif image files. The example sets up a panel on a frame and then uses wx.animate.GIFAnimationCtrl() to do the hard work. Actually pretty simple code. | |
I'm typing the code: [CODE] import cmath import math print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) pow(2,3,1) [/CODE] and I'm getting this error: File "sample2.py", line 26 print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) pow(2,3,1) ^ SyntaxError: invalid syntax Why is this invalid syntax? | |
Hi, i need to write a recursive function which gets a list and an integer k and returns a list of all the possibilities of creating sub lists to the length of k with the elements from the original list. i hope i was clear enough.. here are some examples: … | |
Hi All i have downloaded "xmldiff-0.6.10" from their official site (http:// [url]www.logilab.org/859[/url]). I have tried installing the same on my 32 bit Windows 7 OS using the command "setup.py install" but below exceptions are thrown in the console. please help me out in installing this package on Windows Exceptions thrown … | |
Hi, how best can one put different images on a stack to form a single array. For example, |image1.flatten()| |image2.flatten()| |image3.flatten()| So that each row of the array would be a specific image. | |
Hello everyone, I generate an executable for an application in Python with Tkinter interface , on my machine when I double click on the executable the application execute well. The problem arises when I move the entire file on another machine, while there on a machine that executable runs from … | |
Hello people. I learning phyton and have a problem. [CODE]def Cel2Fah(temp): Fahren = str((9.0/5.0)*temp+32); return Fahren;[/CODE] I was asked to write a function which converts celsius to fahrenheit([url]http://www.pyschools.com/quiz/view_question/s2-q5[/url]). It says: "Return a string of 2 decimal places", but i dont know how to. |
The End.