15,190 Topics

Member Avatar for
Member Avatar for mckillmt

I am trying to program a game and am having trouble with collision detection. I am trying to get the "monsters" to chase the "knight" when the knight gets close. I am using Panda3D to run the game. I have three classes, the Knights Quest, monster, and wasdCamera. I am …

Member Avatar for shadwickman
0
88
Member Avatar for shadwickman

Hi, I didn't really know how to word the title, but I was just wondering if it was possible to write a function and make it accessible as if it was any other str function. It was a simple (but useful) few lines which returned a list of all the …

Member Avatar for shadwickman
0
156
Member Avatar for Prahaai

Good day. I've been trying to port HGE ([url]http://hge.relishgames.com[/url]) to Python for more than 4 months now... HGE is a hardware accelerated 2D game engine. It comes with the source and examples. In the folder "include", you can find "hge.h", the file that i am talking about in all the …

Member Avatar for Prahaai
0
288
Member Avatar for mn_kthompson

I've been trying to step into learning wxpython, so I followed some examples on the web and put together this very simple application. The good news for me is that it is working almost exactly as I would expect it to. I do have a couple of questions for the …

Member Avatar for Stefano Mtangoo
0
481
Member Avatar for Andrew Wiggin

I am trying to use shutils to copy a folder but it throws errno 13 at me. The traceback points to open() as the culprit. I wrote a test script: open(raw_input("Filename: ")) this is the result: Filename:e: Traceback (most recent call last): File "C:\Documents and Settings\talvey\Desktop\testOpen.py", line 1, in <module> …

Member Avatar for lllllIllIlllI
0
16K
Member Avatar for Piratenaapje

I'm currently developing a Google Reader Notifier for linux (check it out at [URL="http://grnotify.sf.net"]http://grnotify.sf.net[/URL] if you're interested), and need to be able to open the users default webbrowser and login to google reader automatically. I currently do this using the webbrowser module, and then using the command webbrowser.open("http://google.com/reader"). But this …

Member Avatar for EAnder
0
99
Member Avatar for vasioky

Hi guys! I 'm new in python and i don't how can I capture resize event on root, can anybody help me?

Member Avatar for vasioky
0
58
Member Avatar for Littlerocks

Thanks in advance. I am wriiting a code about Conway's game of life,and i am a beginner of python,have looked at my code for hours,still couldnt find out the bug...when i run it,it doesnt work....only return the same matrix as the test code given..anybody can help with check it would …

Member Avatar for Littlerocks
0
117
Member Avatar for Gribouillis

Python 3.0 comes with a builtin [icode]print[/icode] function which breaks old code. In order to write code wich is compatible both with the 2.x series and with the 3.x series, I'm using the following [icode]Print[/icode] function [code=python] import sys def Print(*values, **kwd): fout = kwd.get("file", sys.stdout) sep = kwd.get("sep", " …

Member Avatar for Gribouillis
0
167
Member Avatar for anilk

Hi All, I am a total newbe to python. I am using some already available code to send email from commandline using my Gmail account. For the piece of code smtp = smtplib.SMTP('smtp.gmail.com', 587) I get a error ################ Traceback (most recent call last): File "Mail.py", line 44, in <module> …

Member Avatar for Stefano Mtangoo
0
1K
Member Avatar for pocnib

I need to write a Python program which parses webpages and returns a dictionary of unique words and their frequenies. What I came up with was [CODE]#!/usr/bin/env python from HTMLParser import HTMLParser, HTMLParseError import urllib import urlparse import sys import os import MySQLdb import re class WordHarvester: def __init__(self): self.db …

Member Avatar for woooee
0
440
Member Avatar for happymadman

Hi Is there a way to check if a float is a whole number eg 10.0, 7.0 or somthing.0 I'm doing problem 5 on project eular Mayby I have the complete wrong idea here is my code: [code] numbertobetested = 0.0 loop2 = 1 while loop2 == 1: numbertobetested = …

Member Avatar for sneekula
0
98
Member Avatar for Puppetmaster

Is it possible to have a program run multiple functions at the same time? Connectionist neural network programming seems suitable for object oriented languages. But brains seem to be able to have multiple faculties working all at the same time, and in orchestra with each other. BTW I'm a complete …

Member Avatar for Prahaai
0
103
Member Avatar for kruglok

I got first part by creating it using for loop. But got stuck on while loop. Would you see what I'm doing wrong. # Calculating number of vowels using for loop count = 0 word = raw_input("Please enter a phrase: ") for letter in word: if letter in "aeiou": count …

Member Avatar for jlm699
0
17K
Member Avatar for wotthe2000

Is there any way of finding words in a 10 x 10 grid, going horizontally and vertically? For example, if i had a text file with the following in: xxxplanexx xrxxxxxxxx xexxxxxyxx xdxxxxxexx xxxxxxxlxx xxxxxxxlxx xxxxxxxoxx xxxxxxxwxx xkingxxxxx xxxxxxxxxx how would you be able to find the words red and …

Member Avatar for Murtan
0
270
Member Avatar for Damian_xyz

Hello all, I'm trying use this script: [url]http://www.estamos.de/blog/2008/09/05/getting-things-done-gtd-migration-from-d-cubed-to-monkeygtd/[/url] I've tried it on my windows machine (with ActivePython installed) and on my Ubuntu machine. On both, I get this error message: File “d3tomgtd.py”, line 30, in import xml.dom.DOMImplementation ImportError: No module named DOMImplementation The script's creator seems to think that "xml" …

0
52
Member Avatar for adam291086

I am trying to print out a dictionary result. The dictionary is made from a database search. I have tried to print it in every possible way here is the code [CODE]#!/usr/bin/python import elementtree.ElementTree as ET import urllib import MySQLdb print "Content-type: text/html\n" info={} def find_text(element): if element.text is None: …

Member Avatar for adam291086
0
120
Member Avatar for Micko

Hello, I'm writing a simple calculator in C. The main problem is I need to parse string to evaluate for example 1+2*(3-1)/2.5. However writing such parses is a very hard task. This is a trivial thing Python using this code: [code] s = raw_input('Please enter expression:') try: x = eval(s) …

Member Avatar for hunkaboy2003
0
4K
Member Avatar for StarZ

Hello, I'm Still a python beginner. I've got this Assignment, and I think I've finished half of it. Can anyone help me out on this assignment. The codes I have done already are: [I]The assignment asks to: Make a program that prints a list of 5 items in your house …

Member Avatar for Murtan
0
136
Member Avatar for cyberjam39

Hi I've been learning python through andrew harrington's guide, but i got stuck on a problem where you enter a list (ex. ['very', 'hot' 'day'] and have the IDLE return this----> 'veryhotday'. Ive been thinking on how to do that using a for loop statement as was intstructed in the …

Member Avatar for sneekula
0
105
Member Avatar for jvignacio

hey guys havin some problems getting to add up the check boxes ticked in python from a form.. this is my html file: [CODE]<html> <body> <form action="cgi-bin/cost.py" method="POST"> <p>Enter Name: <input name="name" type="text"/></p> <p>4 x 100-watt light bulbs for $2.39:<input name="4 100 watt" type="checkbox" value="$2.39"/></p> <p>8 x 100-watt light bulbs …

0
72
Member Avatar for jloyzaga

I have a vbs script and I'd like to convert this bit to python, It runs a macro within an excel spreadsheet and outputs 4 select lists <code> Set oExcel = CreateObject("excel.application") Var = oExcel.Run ("'I:\Data\CISSS\Resources\UserIDPassword.xls'!mymacro") </code>

0
41
Member Avatar for gabec94

I am writing a program that accepts a sentence and then prints out the longest line, this is what I have so far, but I am lost on what the x variable should be equal to. Any help is appreciated, thanks. sent=raw_input('Enter sentence:') splicedsent=sent.split(" ") longestword=splicedsent[0] if x in range(splicedsent[1:])>splicedsent[0]: …

Member Avatar for gabec94
0
4K
Member Avatar for Stefano Mtangoo

I want to wait the song to finish after it finishes, I want to call another function How do I do that in wxpython

Member Avatar for Stefano Mtangoo
0
144
Member Avatar for mmeclimate

Hi, I'm new to Python and I was given an unknown (supposedly binary) to read. The problem is that I am not sure on how to real the 'actual' data. I have opened the file as: [code=python] f = open('/home/mmeclimate/test/test.dat', mode='rb') f.readline() [/code] The output from readline is: [code] 'MO00\x14\x00\x00\x00\x00\x00\x00\x00\\\x00\x00\x00\xb8\x00\x00\x00\x14\x01\x00\x00p\x01\x00\x00\xcc\x01\x00\x00(\x02\x00\x00\x86\x02\x00\x00\xe4\x02\x00\x00B\x03\x00\x00\xa0\x03\x00\x00\xfe\x03\x00\x00\\\x04\x00\x00\xba\x04\x00\x00\x18\x05\x00\x00v\x05\x00\x00\xd2\x05\x00\x00.\x06\x00\x00\x8a\x06\x00\x00\xf2\x06\x00\x00^\x07\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x05 …

Member Avatar for mmeclimate
0
2K
Member Avatar for Stefano Mtangoo

Hello Developers, I have simple media player that have slider that runs in sync with the song. When I want to move a song on given position using slider it moves slowly with strange gagging sound while other media player like foo/win' media player when you move song to a …

0
61
Member Avatar for Stefano Mtangoo

I have simple player with wx.ListCtrl as playlist. I first Load List through open file dialog. I populate a dictionary with filenames (populated in Playlist) as keys with their path as values. When I press play, the onPlay method calls onSetPath method which looks up for selected file from list …

Member Avatar for Stefano Mtangoo
0
128
Member Avatar for Stefano Mtangoo

Everything seems to be well, but NOTHING GET PLAYED!!!! :oops: I have tried and tried but doesn't work. WHAT IS WRONG???? :shock: [code=python] #media control #Copyright 2008 Evstevemd #Just media Player to play the playee import wx import wx.media as media import os, sys class MediaPlayer(wx.Frame): def __init__(self, parent, id, …

Member Avatar for Stefano Mtangoo
0
170
Member Avatar for krammer

How would I empty my linux trash from python? Would I just do a simple os.remove? Or is there an easier way? I am also working on deleting all files within a directory, for multiple directories. I have found this: [CODE]#!/usr/bin/env python import os def nukedir(dir): if dir[-1] == os.sep: …

Member Avatar for krammer
0
281
Member Avatar for SteveJ.

Ok, so here's the deal. I've got a CSV file in the following format (example): Jon | Steve Frank | Joe Steve | Jon Joe | Jon I want to create a python program that reads in the CSV file and outputs a count of relationships, if that makes any …

Member Avatar for jice
0
195

The End.