15,190 Topics

Member Avatar for
Member Avatar for peppermints

The commented part is where I believe the issue is at. [CODE]from livewires import games, color import random games.init(screen_width = 640, screen_height = 480, fps = 50) class Paddle(games.Sprite): image = games.load_image("paddle.bmp") def __init__(self): super(Paddle, self).__init__(image = Paddle.image, x = 10, y = games.mouse.y, bottom = games.screen.height) def update(self): self.y …

Member Avatar for TrustyTony
0
614
Member Avatar for theweirdone

Hi, I'm trying to take a date, add a day to it, and then convert it to a string. The date's format starts out like: '10/1/2009', and should end like: '2009-10-1'. I can do that part, but then I can't convert it to a date format and add a day. …

Member Avatar for TrustyTony
0
263
Member Avatar for toll_booth

OK guys, in regards to my [url=http://www.daniweb.com/forums/thread273163.html]last thread[/url], I've decided to give PIL a shot. Trouble is, the setup instructions are as clear as mud. I've got the files downloaded and extracted, but that's as far as I've been able to get. Can someone, IN PLAIN ENGLISH, walk me through …

Member Avatar for toll_booth
0
202
Member Avatar for dpswt

Hello everyone. My question is how can we save the items on listctrl so everytime someone opens the application, the items previously added are there. I'm trying to accomplish this with wx.Config, but I can't seem to find a good way to read the config so it accomplishes what I …

Member Avatar for lllllIllIlllI
0
244
Member Avatar for cyon

Given s.ss or seconds accurate to the hundredth place, what is the most effective way to convert it to the string mm:ss.s? Here is my current attempt: [CODE]import time def convert(t): print time.strftime("%M:%S",time.gmtime(round(t,1)))+str((".%01d" % (((round(t,1))-int(round(t,1)))*10))) t = float(raw_input('Enter time in s.ss: ')) convert(t)[/CODE] However, the results don't seem quite right: …

Member Avatar for TrustyTony
0
547
Member Avatar for rasizzle

Hey guys. I just started using portable python and I have to say this module is great. It helped me bypass some problems transferring modules between win32 and win64 cpus. So my question is for all you portable python users is: do you have to install python for each new …

Member Avatar for rasizzle
0
180
Member Avatar for soUPERMan

hello, was wondering how to sort a list which has different data types according to the data type, Example if a list containing 'person' objects. a person object wil have a name, gender and age like so: person1 = person(name, gender, age) so if i have 5 objects in a …

Member Avatar for soUPERMan
0
84
Member Avatar for elmaami

Hello I want u to help me about how to encrypt file is sent between web client and web server. Thank u....

Member Avatar for jcao219
0
47
Member Avatar for theweirdone

Hi, I'm making something of an RSS reader-ish. I'm using the [URL="http://www.feedparser.org/"]Universal Feed Parser[/URL] to do this. The feed is just a list of TV shows, and the date they air. I'm successful at getting the feed, now what i'm trying to do is split it up into chunks that …

Member Avatar for theweirdone
0
126
Member Avatar for cyon

Is there a way to, instead of duplicating code, to either print the desired number of rows from a list (from user input) or print all items in the list? [CODE]print_list( input ): f = open('pickle.dat', "r") L = cPickle.load(f) f.close() for i in range( input=len(L) ): print 'L[i] = …

Member Avatar for TrustyTony
0
124
Member Avatar for lebron

I have something to share with you guys if you can help me out.. Here is an algorithm to print out a pyramid of numbers: [I][B]define totalRows to be how many rows define columnWidth to be how many characters in each column for currentRow in range 0 up to (but …

Member Avatar for TrustyTony
0
157
Member Avatar for lebron

'''check addition''' from random import randint def checkAddition( a, b ): ans = int(raw_input("What is %d + %d ? " % (a,b))) if ans == a + b: return True else: return False def main(): x = randint(1,100) y = randint(1,100) if checkAddition(x,y): print "Correct" else: print "Incorrect" main()[B] [I]This …

Member Avatar for Kruptein
0
100
Member Avatar for Kruptein

I was wondering if it was possible to use pygments with wxPython? I want to use it on the text_ctrl widget. If it is not possible on that widget but is possible on an other please tell me...

Member Avatar for Kruptein
0
193
Member Avatar for vegaseat

A little late for April 1, but here is the secret code ... [code]searchEngineNames = [] for c in range(ord('A'), ord('Z')+1): name = chr(c)+'ing' searchEngineNames.append(name) # pick #1 print(searchEngineNames[1]) [/code]

Member Avatar for TrustyTony
4
107
Member Avatar for ITgirl2010

i have been working on this code [code=syntax] '''Calculate the cost of fuel for a road trip''' def main(): distance = float(raw_input("Enter distance in kilometres: ")) litresPer100K = float(raw_input("Enter economy (ltr/100km): ")) pricePerLitre = float(raw_input("Enter fuel price per litre ($): ")) cost = distance / 100 * litresPer100K * pricePerLitre …

Member Avatar for ITgirl2010
0
115
Member Avatar for Dan08

Hey, I have a really big file on my computer, this file only got words in it. And because the file is really big, I sure there are repeted words in there. Is there a way of deleting every single repeated word, leaving at least one? Every single word is …

Member Avatar for TrustyTony
0
4K
Member Avatar for ultimatebuster

How would one use Python as a PHP alternative? If there a hello world example somewhere?

Member Avatar for snippsat
0
134
Member Avatar for Toddh86

Hi, just hoping someone can shed some light on the best way to read from a text file. I wish to create a program that will grab out specific words/numbers when chosen. I need to be able to extract data from different fields but also be able to determine if …

Member Avatar for TrustyTony
0
355
Member Avatar for leviaeon

i am having this problem related to function implementation. my program is about sending an unread sms string to a bluetooth module and after sending the strings of sms messages it will mark the unread messages as read then move to a sms notification function that will notify me is …

Member Avatar for leviaeon
0
116
Member Avatar for capson

Hello, the code I am posting sorts a pivot table but there can be only one statistic per row e.g Mean or Count. I often have multiple statistics per row e.g Mean, Mode etc... . I often have to generate multiple, long, pivot tables and to sort them manually is …

Member Avatar for TrustyTony
0
205
Member Avatar for n.utiu

Let's say we have this code : [CODE]#include <iostream> #include <boost/python .hpp> using namespace boost::python; class A{ void foo (void) { std::cout << "Hello World"; } }; BOOST_PYTHON_MODULE(hello) { class_ <A> ("A") .def("foo", A::foo); }[/CODE] and I have an object of type A named MyCPPClass and I want to make …

0
60
Member Avatar for lebron

This is problem part of my assesment I've done but my assesment says use a function to calculate the fuel cost and function should take 3 parameters : distance,economy(as litres per 100 kms) , and fuel price per litre. The function should return the total cost of trip. Could you …

Member Avatar for lebron
0
4K
Member Avatar for The-IT

hi, i have been trying to get Tkinter to play a sound, however, tkSnack has brought me to this random error which i can't emplane, but i think its something to do with my operating system, ubuntu. [code]Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.5/threading.py", line 486, …

Member Avatar for Brionius
0
160
Member Avatar for kur3k

hey gues i search 'replace' matrix? 123 456 789 i need in output 147 258 369

Member Avatar for TrustyTony
-1
145
Member Avatar for JordanWalcaraz

Hi everyone, I know this is a very beginner inquiry, but I can't seem to figure out exactly what it is that I'm doing wrong. I'm using this tutorial: [url]http://www.sthurlow.com/python/lesson05/[/url] to build a simple calculator program. My version of Python is 3.1.2 here is my code: [code] loop = 1 …

Member Avatar for hondros
0
139
Member Avatar for TrustyTony
Member Avatar for TrustyTony

I optimized very carefully program I was producing by producing the main tight loop functions half a dozen times with various implementation styles. Also i considered amount of passing information in call hierarchy in parameters or letting functions to trust proper initialization of the global variables. I got few interesting …

0
111
Member Avatar for shaftoe

Hi, I've had a bit of experience with perl and shell scripting. I've been reading the O'Reilly Python book and have been having a go at replicating some of our perl scripts in python (v3.1.2). I'm looking to put something together than will parse through large xml files and manipulate …

Member Avatar for shaftoe
0
149
Member Avatar for dpswt

Hey guys, I'm new here and my question is what to use (if it exists) and possibly how to simulate a "notebook" where instead of Tabs I would like to do it with buttons (wx.Button). Being more specific, what I would like to do is to make the same functionality …

Member Avatar for dpswt
0
176
Member Avatar for kar0lis

Hi how to kill the[B] recv [/B]or [B]recvfrom [/B]in socket connection, then there is no data and the functions recv, recvfrom is in waiting mode.?for example: [CODE] sock=socket.socket(...) sock.bind((host,port)) while True: packet,address=socket.recvfrom() print packet [/CODE] if there is no data on socket it is waiting, so how to kill it …

Member Avatar for Gribouillis
0
146

The End.