14,951 Topics

Member Avatar for
Member Avatar for tcotto

So I have this assignment where we have to create connect 4 using classes and make it so you can play against a player or computer. The problem I'm having is returning to the function if the user enters something other than one or two. I know I have to …

0
16
Member Avatar for albertkao

How do I recursively remove all the directories and files which begin with '.'? My test program rmdir.py does not do the job yet. Please help. Code: #!c:/Python31/python.exe -u import os from shutil import * root = "C:\\test\\com.comp.hw.prod.proj.war\\bin" for curdir, dirs, files in os.walk(root): print (curdir) print (dirs) for d …

Member Avatar for sergb
0
185
Member Avatar for TitusPE

Hi folks, I wonder if anyone out there could help me with something. I have a folder containing many cnv files that look like this: * Sea-Bird SBE 9 Data File: * FileName = C:\CTD Data\Alg173\stn001.dat * Software Version Seasave Win32 V 5.38 * Temperature SN = 4977 * Conductivity …

Member Avatar for TrustyTony
0
203
Member Avatar for albertkao

I want to walk a directory and ignore all the files or directories which names begin in '.' (e.g. '.svn'). Then I will process all the files. My test program walknodot.py does not do the job yet. Please help. [CODE]#!c:/Python31/python.exe -u import os path = "C:\\test\\com.comp.hw.prod.proj.war\\bin" for dirpath, dirs, files …

Member Avatar for jice
0
3K
Member Avatar for macca21

How can I tabulate the data strings I have saved in another file... the data sored is in the form of names and scores. The table should look like: Name Score 1 Score 2 Score 3 ==== ======= ======= ======= John 23 21 34 etc... I've started with this and …

Member Avatar for TrustyTony
0
189
Member Avatar for Mezzck

I'm new to Daniweb and with Python and I'm quite bad with it to be honest D:.. Here is my code... [CODE]from Tkinter import * class App(Frame): def createWidgets(self): self.grid() self.lbspace = Label(self, text="") self.lbspace.grid(row=0,column=0) self.lbfirstName = Label(self, text="First Name:", font=("Calibri", 12)) self.lbfirstName.grid(row=1,column=0) self.firstNameVariable = StringVar() self.firstName = Entry(self, textvariable=self.firstNameVariable, …

Member Avatar for Mezzck
0
413
Member Avatar for thehivetyrant

Hi there, I'm currently in the process of creating a Multi-User Dungeon (MUD) in python. It'll allow multiple users to explore a text based world. I've got a basic server but i can't seem to get a client to work with it. [B]MUD server.py[/B] [code] import socket #Connect with telnet …

Member Avatar for griswolf
0
691
Member Avatar for pixeldroid

I'm learning Python to use wMaya - a 3D graphics app. While reverse engineering some code, I [URL="http://www.daniweb.com/forums/thread89440.html"]found a thread here[/URL] which explains "list comprehension". The code I'm analyzing uses that, so I attempted to deconstruct it, but I can't reproduce the same results using a for loop. I have …

Member Avatar for TrustyTony
0
235
Member Avatar for owls

Hello I am trying to get this program to log key presses while running hidden in the background. I have no troubles while I run this program as a .py or .pyw The trouble comes though when I have turn this file in to an .exe using py2exe It will …

0
31
Member Avatar for ShinyDean

I am currently using the Pil library for a project, however i keep running into the same problem which will not let me do anything at all. [CODE][/CODE] def bw_negative(filename): # Create the handle and then create a list of pixels. image = Image.open(filename) pixels = list(image.getdata()) print pixels[0] print …

Member Avatar for vegaseat
0
2K
Member Avatar for Seagull One

I'm working with some code to have a robot do vision processing, speech recognition and text-to-speech. I'm using python2.6 and openCV The objective of the code is to have the robot recognize faces via webcam and say, "Hello." It does this more or less perfectly, except for one thing. A …

Member Avatar for jcao219
0
135
Member Avatar for snippsat

Many of us like wxpython,so is always fun with a new tool.:) [url]http://wxformbuilder.org/[/url]

Member Avatar for joetraff
2
902
Member Avatar for Kruptein

Hey, I've made a program called d-cm, it's a web-development tool. I want to know if everything works and/or if it works on windows too. Therefore I'm asking if some people are willing to test it... [url="http://code.google.com/p/d-cm/downloads"]googlecode project link[/url] P.S. I'm posting it here because in the Show off your …

0
77
Member Avatar for ultimatebuster

Is this needed? [CODE] class Test: def __init__(self, f): self.f = open(f) def __del__(self): try: self.f.close() except: pass [/CODE] Also, how can i open a file, and have it in append mode. However, if the file doesn't exist, python creates it?

Member Avatar for HiHe
0
129
Member Avatar for HiHe
0
9K
Member Avatar for HiHe

The small code shown below works fine with Python26, however Python31 gives an error: fout.write('.snd' + pack('>5L', 24, 8*dur, 2, 8000, 1)) TypeError: Can't convert 'bytes' object to str implicitly Does anyone know what I need to do to make it work with Python31? [code]# create a soundfile in AU …

0
75
Member Avatar for Lapixx

Hi, I'm trying to create a textgame in python, and after searching for a few topics about it I though I knew how to make it. Many textgames use a system like this: [CODE]def room_one(): #do stuff if something: room_two() def room_two(): #do stuff [/CODE] Most of the time the …

Member Avatar for ultimatebuster
0
165
Member Avatar for TrustyTony

Here is my newest baby, the pretty.py module, born today, which I start to use instead of pprint module. Reason to make this (in addition to that it is possible to do) is that I had this problem, sorry long, LONG example: UPDATE: take out the [CODE]or j[/CODE] that was …

Member Avatar for TrustyTony
0
1K
Member Avatar for alabandit

I generate an array from the folders in a directory; which is placed in an array. i then compare it for changes in the currant folder.This way i can monitor for new files that are add to the system and trigger the script. but i am having problems comparing the …

Member Avatar for alabandit
0
120
Member Avatar for nsutton

I know the code for sending mail is. [CODE] import smtplib fromaddr = 'fromuser@gmail.com' toaddrs = 'touser@gmail.com' msg = 'There was a terrible error that occured and I wanted you to know!' # The actual mail send server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(username,password) server.sendmail(fromaddr, toaddrs, msg) server.quit() [/CODE] Basically its a …

Member Avatar for nsutton
0
111
Member Avatar for Aeronobe

I'm having this problem with passing a variable. Basically i'm trying to find every url in a HTML document. I'm doing this using the HTMLParser class (i made an extension of it). This is the code: [ICODE]class Parser(HTMLParser.HTMLParser): def __init__(self, url): HTMLParser.HTMLParser.__init__(self) req = urllib2.urlopen(url) self.feed(req.read()) def handle_starttag(self, tag,attrs): if …

Member Avatar for Aeronobe
0
93
Member Avatar for Qwazil

Hey all, I'm a beginner. When i feed a list of lines into this for statement, i have trouble getting the output into a set for use outside of the for statement. [CODE] ListofWordsinLines = {} words = [] for line in ListOfLines: words = line.split() ListofWordsinLines = set(words)[/CODE] if …

Member Avatar for TrustyTony
0
155
Member Avatar for jpl1993

class tennis: def __init__ (self, name, rank, tournamentsPlayed, country, racquetBrand): self.name = name self.rank = rank self.tournamentsPlayed = tournamentsPlayed self.country = country self.racquetBrand = racquetBrand #defines each thing^ def __str__(self):#creates a string return self.name + ":" + self.rank + "\n" + self.tournamentsPlayed + "\n" + self.country + "\n" + self.racquetBrand …

Member Avatar for TrustyTony
0
127
Member Avatar for Hawkeye Python

I'm trying to create a python cards game (a Brazilian cards game). But when I try to print some values (the cards played) it returns the following error: [QUOTE]Traceback (most recent call last): File "<pyshell#16>", line 1, in <module> play() File "C:\Documents and Settings\Terminal\Desktop\Truco.py", line 71, in play print "You …

Member Avatar for Hawkeye Python
0
230
Member Avatar for SgtMe

Hi. I am trying to get texturing to work in PyOpenGL in 2D. I have the following code so far for textures: [CODE]def tex(path): img = pygame.image.load(path) img.convert_alpha() try: ix, iy, image = img.get_width(), img.get_height(), pygame.image.tostring(img, 'RGBA') except SystemError: ix, iy, image = imgs.get_width(), img.get_height(), pygame.image.tostring(img, 'RGBA') ID = glGenTextures(1) …

0
82
Member Avatar for azrael_

Hi there. I am currently writing a registration program in Python, and have come across a problem. In my hours of searching, there seems to be no way to split a list that has elements obtained from [B]raw_input[/B]. Basically, I would like to take input from a user, feed it …

Member Avatar for TrustyTony
0
214
Member Avatar for chebude

I was able to print out daily values and aggregate the final annual result but I am lost and dont know where to start on how to sum the daily values to monthly and print it out. I need your help badely. Here is part of the code [CODE] import …

Member Avatar for woooee
0
144
Member Avatar for capri19

hi all I'm trying to make a simple web using a form and method="POST" My page works fine in Firefox but fails in IE6. Can anyone tell me what I'm doing wrong ? Here is my code [code] import cgi import os import parseFieldStorage import time def test(): print 'Content-Type: …

Member Avatar for tamarteleco
0
188
Member Avatar for jpl1993

so i'm almost done with my project. however, i'm still getting some errors when i run. you can find my code below. if you see any problems and know how to fix them, please, please, please let me know! class tennis: def __init__ (self, name, rank, tournamentsPlayed, country, racquetBrand): self.name …

Member Avatar for woooee
0
145
Member Avatar for jib

[B][INDENT]below is the tutorials for developing the program i had a hard time with it. Part 1: Blackjack Card Game Blackjack is a card game played in casinos. The game is also called Twenty-One. Blackjack came originally from France, where it is called Vingt-Et-Un (21). The goal for both the …

Member Avatar for woooee
0
357

The End.