Is there a way to keep track of the number of times someone clicks on a
menu item in a prorgam? What I want to do is make the rectangle
disappear after they click on it at the main menu 3 times so visually
show them they can't do it any longer.
Since I appended the button to a main menu list,
Is there a way to keep track of the number of times someone clicks on a
menu item in a prorgam? What I want to do is make the rectangle
disappear after they click on it at the main menu 3 times so visually
show them they can't do it any longer.
>
> Since I appended the button to a main menu lis
I'm writing a game that uses two functions to check and see if a file
called highScoresList.txt exists in the main dir of the game program.
If it doesn, it creates one. That part is working fine. The problem is
arising when it goes to read in the high scores from the file when I
play again.
I'm writing a game that uses two functions to check and see if a file
called highScoresList.txt exists in the main dir of the game program.
If it doesn, it creates one. That part is working fine. The problem is
arising when it goes to read in the high scores from the file when I
play again.
Sorry, 4got to send it in html for the bold parts.
thx
def drawMainMenu(win):
#define and draw the buttons
mainMenuList = []
mainMenuList.append (CreateRect(4,6,7,8,"grey",win))
mainMenuList.append (CreateRect(3.5,6.5,5,6,"grey",win))
mainMenuList.append (CreateRect(3.5,6.5,3,4,"g
For my final project, I'm trying to do a GUI based game similar to are
you smarter then a 5th grader. I've been working on it and am stuck
with some code someone helped me with to randomize the A,B,C,D letters
that the correct answer is assigned too. The code that does this is
highlighted in
I'm just trying to test and see if the get mouse statements are working
in my program. If they are, in the console window, it should go back to
the prompt. It doesn't for all of them, just the last
rectangle...sometimes. Am I setting them up correctly? here's the
relevant code...thx
The f
1. whats the best way to round a result to 4 decimal places?
I tried round, but then read that it only works with exponents of 10.
I'm trying to do it on this piece of code.
time = (distance / 4900)
2. What direction would I go in if I'm getting 5 inputs from the user
and want to make a bar t
Hmm...it works fine within the command line but then when I import os in
python and then try os.system("cls"), i get that very fast
opening/closing window and 0 inside the shell.
Gabriel Genellina wrote:
> En Mon, 29 Oct 2007 00:08:14 -0300, Shawn Minisall
> <[EMAIL
Does anyone know how to clear the shell screen completely ? I tried
import os and then os.system("clear") was said to have worked in Windows
XP, but it's just bringing up another window, then it turns black and
then it closes in within about a second moving the prompt at the
os.system("clear")
about or ever cover them in class. I think we get
to true statements in the next chapter next week.
It turns out that my problem was with indentation, as soon as I fixed
it, it's working perfectly now.
thx
Dennis Lee Bieber wrote:
> On Sat, 27 Oct 2007 15:11:37 -0400, Shawn Minis
K I've since fixed the UnboundLocalError: local variable 'ai' referenced
before assignment error, I forgot to include decision = (1, 2, 3) inside
" " for each number.
Now when I run it, I get this..
>>> main()
READY TO PLAY ROCK, PAPER, SCISSORS???
Please choose from the following menu:
1. Se
I've been having some problems with using a while statement for one menu
within another while statement for the main menu, first time I've done
it. It's with choice number two from the menu. When I run the program,
I get a UnboundLocalError: local variable 'ai' referenced before
assignment.
I agree, but if I want to get a A on the program, thats how my professor
wants the output.
:)
[EMAIL PROTECTED] wrote:
> On Oct 22, 9:12?pm, Shawn Minisall <[EMAIL PROTECTED]> wrote:
>
>> Thanks, everyone! Using everyone's suggestions and points, the program
I just wrote a program to let the user input a series of whole numbers
and tell them which is least and which is greatest based off of a menu.
However, the menu isn't kicking in after they pick a number. I included
a while statement for a loop just for the menu and compared it to my
other pro
ECTED] wrote:
> On Oct 22, 5:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>> On Oct 22, 5:22 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>
>>
>>
>>> On Mon, 22 Oct 2007 18:17:56 -0400, Shawn Minis
#Intro
print "*"
print "WELCOME TO THE POPULATION GROWTH CALCULATOR"
print "*"
print "This program will predict the size of a population of organisms."
print
print
organisms=inp
I just learned about while statements and get why you place them around
inputs for validation, but I'm a little lost on exactly where to place
it with what condition in this program where the number of fat grams
exceeds the total number of calories so that it loops back and asks you
the two que
I just learned about if, then elif statements and wrote this program.
The problem is, it's displaying all of the possibilities even after you
enter a 0, or if the fat grams are more then the total number of
calories , that is supposed to stop the program instead of continuing on
with the print
Fredrik Lundh wrote:
> Shawn Minisall wrote:
>
>
>> Sorry, it looks like it's on the fourth line with the 3 values on line
>> 4...its reading line 3 fine
>>
>> Traceback (most recent call last):
>> File "", line 1, in
>>
Marc 'BlackJack' Rintsch wrote:
> On Thu, 27 Sep 2007 12:36:58 -0400, Shawn Minisall wrote:
>
>
>> With the multiple value lines, python says this "ValueError: too many
>> values to unpack"
>>
>> I've googled it and it says that happen
I am trying to read a few lines of a file with multiple values, the rest
are single and are reading in fine.
With the multiple value lines, python says this "ValueError: too many
values to unpack"
I've googled it and it says that happens when you have too few or too
many strings that don't mat
I am trying to read a few lines of a file with multiple values, the rest
are single and are reading in fine.
With the multiple value lines, python says this "ValueError: too many
values to unpack"
I've googled it and it says that happens when you have too few or too
many strings that don't mat
I'm trying to unpack a list of 5 floats from a list read from a file and
python is telling me 5 variables are too many for the string.split
statement. Anyone have any other idea's? NOTE: the only reason I
convert it to a float instead of just leaving it as a string in the loop
is because I ha
I thought it could work both
ways?
Paul Rudin wrote:
> Shawn Minisall <[EMAIL PROTECTED]> writes:
>
>
>> I'm trying to write a program that gets the first letter of every word
>> of a phrase and prints it on screen. I'm having problems with it.
>&g
I'm trying to write a program that gets the first letter of every word
of a phrase and prints it on screen. I'm having problems with it. I'm
thinking a for loop would be good since I don't know the exact number of
words the user is going to enter, but after that I get confused. How do
I tell
I'm trying to get a space in between these two strings but it's ignoring
the space in between when it prints.
>>> string.capwords (string.join([s1 + " " + s2])) * 3
'Spam Ni!Spam Ni!Spam Ni!'
>>>
--
http://mail.python.org/mailman/listinfo/python-list
:)
--
http://mail.python.org/mailman/listinfo/python-list
Hi everyone, I'm a beginning programming student in Python and have a
few questions regarding strings.
If s1 = "spam"
If s2 = "ni!"
1. Would string.ljust(string.upper(s2),4) * 3 start it at the left
margin and move it 12 spaces to the right because of the 4 *3? If so,
why is it in the parath
29 matches
Mail list logo