14,946 Topics

Member Avatar for
Member Avatar for pythonlearning

I am learning parse command line options by optparse,when I want to parse input file from command line and then use part of it as output file name: [CODE]import optparse parser=optparse.OptionParser() parser.add_option("-input", dest="inputFile") parser.add_option("-output", action="store", dest="outputFile", default=options.inputFile.rstrip(.txt), type="string") (options, args)=parser.parse_args() print "options.inputFile=", options.inputFile print "options.outputFile=", options.outputFile [/CODE] When I call …

Member Avatar for woooee
0
80
Member Avatar for jattvelly035

hello I am new to deniweb and programming.I need your help for my game development i read a programm from your site but i didnot understand anything because i am doing python 3.1.I hope you will help me I want TEXAS HOLD’EM POKER HAND EVALUATOR and i am sending you …

Member Avatar for woooee
-1
161
Member Avatar for Tcll

ok... so I've decided to start work on a model converter... I'm a lousy Py programmeer and I'm trying to understand a few things... but first off: I want to store vert XYZ data in 'verts' as a list... say we have 3 verts, the var would look like this: …

Member Avatar for Tcll
0
773
Member Avatar for pdini

Hi all, I have a problem with QBrush in PyQt. Hi updated my computer and updated pyqt and what used to work doesn't anymore: I have a QBrush and when I try to update the color it doesn't work: brush = QBrush(QColor(255,255,255,255)) print brush.color().getRgb() # output: (255, 255, 255, 255) …

0
52
Member Avatar for TrustyTony

This code is giving minimal change from real Python class to JavaMonster with every method having setter and getter not following the PEP8 naming but capitalizedWordsFormat. When instrunctor turns his head or if you put the code in your library, you can simply remove the setter/getter lines.

0
259
Member Avatar for nk28

Hey all I am trying to make GUI windows using Tkinter and have got stucked. Its exactly like an installation setup where you move to new windows . I have been unable to understand how to create multiple application windows in Tkinter. I want that according to user input I …

Member Avatar for SgtMe
0
790
Member Avatar for pixelss

Hello, i'm learning object -oriented programming, I was told to create a program that once the class had been designed, to create an object of the class and prompt the user to enter the name, type, and age of his or her pet. The data should be stored in the …

Member Avatar for SgtMe
0
899
Member Avatar for python01

I am trying to make a bidding sniper. all functions work so far (bidding, timing, etc), yet I still have to login manually. Would anyone know how I could open a website and then login automaticly from python. Thanks, python01

Member Avatar for python01
0
84
Member Avatar for Tommymac501

I need a small tool to print a record layout with a row of data to proof the layout and data match. To that end, I am using a CSV to pick up a record, and a list to store the field names. What I want to do is to …

Member Avatar for Tommymac501
0
87
Member Avatar for Thropian

I wrote a little program a while back that changes windows a lot and I was wondering if there is a way to have one window open at the same spot the last window closed?

Member Avatar for woooee
0
1K
Member Avatar for ljjfb

Hello, all professionals I aim to create three scripts (one in Host, the other two in 2 different Guests) realizing server vs multi-clients communications. There is a file in my Host system, what I propose to do is transmitting lines in that file to different Guests. Following is the raw …

Member Avatar for ljjfb
0
172
Member Avatar for prexioso

Hi all!!! I have some problems with List comprehension in Python. How can I obtain these two nested list using comprehension? list1 = [[1,2,3],[4,5,6],[7,8,9]] list2 = [[1,0,0],[0,1,0],[0,0,1]] (identity matrix) where list1 and list2 are square matrix of 'n' size thank you in advance!!!

Member Avatar for prexioso
0
128
Member Avatar for G-Do

Hi guys, I'm trying to learn the principles of artificial intelligence. I just finished coding up a belief net and a corresponding EM algorithm that learns the CPTs for latent nodes using training data (if you're unfamiliar with the lingo, you're probably going :eek: right now). While the program (written …

Member Avatar for Gael Varoquaux
0
329
Member Avatar for pythonlearning

I have a dictionary used a string (read from file by number) as key and a list as its value (each may have different number of elements). I want to print like this: 0 4 2 3 -4 5 3 1 -2 3 4 2 3 11 0 1 When …

Member Avatar for pythonlearning
0
144
Member Avatar for Dinnerfortwo

Im trying to add six functions which are six effects to this tic tac toe game. For instance a remove all pieces function. Also, Im trying to restart the DIE roll after every turn made. If I can get the remove all pieces function(reall) to work I can get other …

Member Avatar for Dinnerfortwo
0
434
Member Avatar for txwooley

My daughter plays FaceBook games and is always asking me to solve anagrams. So I thought I would make a script for her to enter a scrambled word and it would compare it to the built-in spell check dictionary. But this code returns words such as quip and quiz when …

Member Avatar for txwooley
0
364
Member Avatar for xtra333

Hi people I am currently working to traverse a tree and do an inorder printing of the tree. Problem is my instructor wants parenthesis around the expressions not the individual numbers. [CODE] def printexp(tree): sVal="" if tree: sVal='( ' + printexp(tree.getLeft()) sVal=sVal+str(tree.getRootValue()) sVal= sVal+printexp(tree.getRight()) +' )' return sVal[/CODE] That is …

Member Avatar for TrustyTony
0
301
Member Avatar for Gribouillis

This snippet defines 3 functions to create in a few seconds an image of a graph containing arbitrary python objects. It uses the module pygraphviz (available at [url]http://pypi.python.org/pypi/pygraphviz/[/url]). See the example use case at the end of the module.

Member Avatar for woooee
1
1K
Member Avatar for 3FLryan

Hello All: I used to be an avid gamer (since I was 7 or 8 years old until recently, and I am now 24). I played anything but my greatest love was turn-based strategy. Games just weren't doing it for me any more - I felt like I could "see …

Member Avatar for 3FLryan
0
182
Member Avatar for winmic

Is there any way to set the maximum size of a ListBox (by pixels)? I know that there is a SetMaxSize but it is not enforced.

Member Avatar for phunehehe
0
700
Member Avatar for king_koder

Hi, I started learning Python 3 around a month ago and I think, I am beginning to get the hang of it. However, I just recently realized that most of the modules I would like to use(wxPython, django,etc) aren't yet ported to Python. SO now, I'm really confused whether I …

Member Avatar for ultimatebuster
0
638
Member Avatar for 1991

Hi, I´m wondering how i can append newly created objects to a list by using subclass.I have come this far: [CODE]class Room(object): def __init__(self,name): self.name=str(name) self.hazard = self.empty #def __str__(self): # return self.name def pits(self,antal): pit=1 while pit<antal: assert self.hazard == self.empty self.hazard=self.Pits # return self.hazard def bats(self,antal): bat=1 while …

Member Avatar for 1991
0
7K
Member Avatar for yellowkaiq

For a project i'm working on now, i need to create a function that is in the format Hours:Minutes: seconds: Fraction where fraction is 1/10th of a second. It should print out every one tenth of a second. I have no idea where to start or how to do this, …

Member Avatar for TrustyTony
0
2K
Member Avatar for ralphcatech

write a program that will act as a single user's ATM machine.....the user will have the following menu options 1. deposit 2. withdrawal 3. view account balance 4. exit constraints for validation user can not deposit less tha zero dollars user must withdraw in $10 increments user can not withdraw …

Member Avatar for TrustyTony
-1
846
Member Avatar for longlongsilver

i have to use the move method for the ship to move. the distance value is less than or equal to the objects fuel attribute.messgae should be displayed reporting the distance the ship moved and the objects fuel attribute should be reduced by the distance value. if not not enough …

Member Avatar for TrustyTony
0
152
Member Avatar for kur3k

Hello, i search widzet for Tkrinter how creat new window ( not Toplevel() ), i want use in this box html thanks ( sorry, my EN is so bad .. )

Member Avatar for kur3k
0
82
Member Avatar for TrustyTony

Based on thread [url]http://www.daniweb.com/forums/thread323401.html[/url], I did this recursive version for comparision. Thanks for posters of the thread!

Member Avatar for TrustyTony
0
1K
Member Avatar for HoneyBadger

Guys I am trying t write this script that finds the age of a daughter through palindromes. Here is the question: Recently I had a visit with my mom and we realized that the two digits that make up my age when reversed resulted in her age. For example, if …

Member Avatar for gwmorris
0
260
Member Avatar for ekkanh

Hi I have a list of False and True, which I have written to a file. When I read the file, I cant get back to my True and False list.... I only get the ["True","False"] version of it, but I want it to be like this: [True,False] Is it …

Member Avatar for ekkanh
0
220
Member Avatar for JasonQiao

How to use RE to solve this, I did it with other method. THANK YOU VERY MUCH! Here is Question: '''Parse Stock prices. Create a function that will decode the old-style fractional stock price. The price can be a simple floating point number or it can be a fraction, for …

Member Avatar for Gribouillis
0
301

The End.