14,945 Topics

Member Avatar for
Member Avatar for mruane

Okay, I just learned that in order to call a program I made in python, say, myfile.pyw, into a seperate program (say, other.pyw) I would use [code]execfile('myfile.pyw')[/code] instead of [code]import myfile.pyw[/code]. I did that, and get one of those ever so helpful traceback errors saying that 'start', the user input …

Member Avatar for Ene Uran
0
118
Member Avatar for JyotiC

hi, i am making a gui, which looks like excel sheets. i want to give the user the facility of adding rows/columns at the run time. there is some initial size, but that can be increased any time during the executation of the code. what i have tried, is that …

Member Avatar for JyotiC
0
83
Member Avatar for macca1111

Hi, I have a class for Cards, that the suits and ranks are placed in suitList = ("Hearts","Diamonds"... rankList = ("","Ace","2"... however I need to read these values from a file instead. Once I read the file I need to be able to sort the suits and ranks then print …

Member Avatar for macca1111
0
102
Member Avatar for macca1111

Hi, I need some help on how to read a file 2 h 3 s 6 d Ace s ... Importing this into Python and then sorting and printing in order. I have done some work, yet I can never seem to get the data to Python and split it …

Member Avatar for macca1111
0
298
Member Avatar for macca1111

Hi, I have the following code working fine. What I would like to try is when n cards are randomly selected, to print the cards in a graphics window. I want to add a new class draw(self,win,center) that displays the card. I have a set of bmp cards. [php]# Import …

Member Avatar for Zonr_0
0
1K
Member Avatar for mruane

Hey, I am trying to create my text adventure geared towards all of the frequent posters on daniweb's python forum, just alittle something to have fun with. But, it isn't going as planned. I used vegaseat's suggestion for combat, shuffling lists randomly to randomize hit/miss results. I think I did …

Member Avatar for Mouche
0
116
Member Avatar for sneekula

What is the most efficient way to spell a string in reverse, for instance s = "banana".

Member Avatar for Mouche
0
122
Member Avatar for mruane

i get this error when trying to run my program. Traceback (most recent call last): File "C:\Python24\secretgarden.pyw", line 12, in -toplevel- denaystart() File "C:\Python24\secretgarden.pyw", line 7, in denaystart prompt_login() NameError: global name 'prompt_login' is not defined

Member Avatar for vegaseat
0
145
Member Avatar for DarkFlash

Hey guys Just joined up the forum, I've been looking for a good community of python users! I'm 17 and I'm in colleg right now getting my transfer degree so I can go major in software development. I've worked with mostly web based langauges for the last couple of years …

Member Avatar for DarkFlash
0
165
Member Avatar for sneekula

If I have an integer like x = 12345, how do I separate that into individual integers 1, 2, 3, 4, 5?

Member Avatar for sneekula
0
118
Member Avatar for mruane

I hope this thread does not offend anyone. I get the impression that most of us are college age prog5rammers, so this might be easily solved. I am attempting to make a menstrual cycle calculator for my fiance. To begin with, I thought about going about it in the following …

Member Avatar for vegaseat
0
84
Member Avatar for Mouche

So if I want to store a list of items (such as a bunch of instances of a class), what's better to use: tuples or lists? I understand that lists are mutable, so what are the advantages to tuples?

Member Avatar for vegaseat
0
136
Member Avatar for DarkFlash

Hey guys, I'm just about done with a program and I need to know how to launch an IE window (or any browser I suppose) from the command prompt. Can anybody help me? thanks!:cheesy:

Member Avatar for DarkFlash
0
257
Member Avatar for Mouche

I was looking through the "beginner projects" looking for a way to use dictionaries so I could understand them better. I saw the caesar cipher suggestion and decided to run with that. I created a working one, but (as I saw in the "If...else") just because something works doesn't mean …

Member Avatar for Ene Uran
0
506
Member Avatar for Dwezill

Hello everybody I have develop a python script who can send message via MSMQ Queing. I use Python 2.2.1 and WIN32all-146 as library. Everything work fine on a W2k station, but if we try to use it on WinXP station it crash. The error message I got is " File …

0
50
Member Avatar for mruane

Alright, so far, what I think the problem begins with is not having a full understanding of syntax, and tabs versus spaces. I have my tab set to four spaces. When I run the following code, the Python GUI (the black ms-dos looking thing, right?) flashes for only a few …

Member Avatar for vegaseat
0
170
Member Avatar for msaenz

Hi, I am trying to parse multiple xml files with sax using python but i for some reason i am having an issue: if someone can just help me get through this part, I would greatly appreciate it. It is parsing to get the attributes amount,unit and the ingredient name. …

0
66
Member Avatar for macca1111

Hi, A simple question I think. I want to create a function that updates variables if a certain condition is met. For example def main(): c=d=e=0 if c[1] == 0: c=c+1 d=d+1 e=e+1 I want to create a function that adds the 1 to c,d,e automatically. def BB(c,d,e) Add 1 …

Member Avatar for Ene Uran
0
79
Member Avatar for gbs

Greetings, In a Python script ("test.py"), I used os.system to execute a c executable "grerand", like below: os.system ("./grerand sequence sequence 1000") If I use this script as a CGI script and invoked it via the web (in this case, the invoking user is an apache user). It gave me …

Member Avatar for Ene Uran
0
112
Member Avatar for Mouche

hey... I wasn't able to find much information on these class methods other than __init__ ... could you explain what these (and maybe some others) do or perhaps just give me a link to a page that explains them: def __repr__ def __str__ def __cmp__

Member Avatar for Mouche
0
102
Member Avatar for Mouche

I searched the forum and couldn't find anything on this, so I guses I'll give this tiny topic its own thread. What's the point of creating a main() function and calling it at the end of your program? Are there advantages to this method in comparison to just writing the …

Member Avatar for vegaseat
0
136
Member Avatar for Mouche

say you have a list: [php] list = [1,a,2,b,3,c,4,d,5,e,6,f,7,g,8,h,9,i,10,j,11,k,12,l,13] [/php] What's the easiest loop set up if I want to store each number (every other slot) into another list? The above list is actually text from a file read and then split with "1 a" and such on each line …

Member Avatar for vegaseat
0
158
Member Avatar for HLA91

Hi When i place this in my script import time.sleep (2) i would like my script to wait for 2 seconds then continue. But when i run it the left bracket is highlighted in red then when iremove the left bracket as i assume that is not supposed to be …

Member Avatar for vegaseat
0
172
Member Avatar for HLA91

Hi Im looking for a time delay code so my script runs to certain line waits for the time specified then continues.Ive found some but they seem to long and complicated. any ideas or links, books ect... Many Thanks HlA91 STAY COOL AND DONT GET STRESSED!:cool:

Member Avatar for Mouche
0
293
Member Avatar for macca1111

Hi, I have the following code: import string def main(): rank=[] suit=[] fname=string.split(open('H:\card.txt').read()) for line in fname: rank.append(line) print rank The file (card.txt) is: 2 h 3 h ... How's the easiest was to get the 2 into rank and the h equal hearts Ultimately i need it to print: …

Member Avatar for Ene Uran
0
122
Member Avatar for theking11

So a kid in my class wanted more of a challenge...the professor gave us one...and I have no idea on this problem. Here's the instructions: Darts scorer. Write a program that draws a darts target and allows the user to click on the target to represent darts hitting the target. …

Member Avatar for Ene Uran
0
3K
Member Avatar for mruane

I recently downloaded Py2exe to make my python2.4 programs executable in motive of possible distribution. I looked online, and most of them tell me I need to use my ms-dos prompt, or command prompt. If these are two different things on my Windows 98 O.S., i cannot find command prompt. …

Member Avatar for Ene Uran
0
92
Member Avatar for macca1111

Hi, If the following def shows if a deck is empty, how do I change it to show the number of cards left??? def isEmpty(self): return (len(self.cards) == 0) I was thinking just taking the ==0 should work, by returning number of cards. macca1111

Member Avatar for Ene Uran
0
101
Member Avatar for sneekula

With the ease of argument passing to and from functions in Python, why would anyone want to use global variables. Isn't that an open invitation for mistakes to happen? Yet, I see code in threads here that abound with globals. I am a little confused here.

Member Avatar for jrcagle
0
139
Member Avatar for macca1111

Hi, I was running Python 2.3 an although I had a few problems it generally worked. I today tried to upgrade to 2.5 and it installs (apparantely) ok, yet when I click on the IDLE icon nothing happens. No error message, nothing. I can however click on the Python (Command …

Member Avatar for macca1111
0
76

The End.