SgtMe 46 Veteran Poster Featured Poster

Start by making a function that allows you to read and write the data from/into text files.

SgtMe 46 Veteran Poster Featured Poster

Sorry Tony, I got distracted after I started writing a reply and your post didn't show up until I had added mine!

SgtMe 46 Veteran Poster Featured Poster

Here is an example. Remember that after reading from a text-file, (if you read the whole line) you may get newline characters ("\n"). Also, you need to remove the spaces.

n = '$ 235.0 M'            #Example string
n = n.strip('$M ')         #Cut off the chars - including spaces!
n = float(n)               #Must convert to int because of the '.0' ('235.0')
##################
print n * 2                #Just to test if it works

Enjoy

SgtMe 46 Veteran Poster Featured Poster

Here is one of the problems.
I copied your program into notepad (correct indentation) and made the two appropriate gif images. I save the problem as a python script and ran it. It opened, drew, and then closed. The reason for this is that you only run through one cycle of updating and drawing the screen. You need to make a 'while loop'. This keeps the statements inside the loop repeating (in the order that they are in) until the 'while' conditions are not met. Using 'while 1' will give you an infinite loop. Inside the loop, you have the statements you want to carry out, but at the end you need to pause your program for a few milliseconds so that it does not crash from running too quickly for your hardware.
Here is what you need to do. Fill the code in in the right places...it should be simple enough ;)

while 1:
	<Clear screen> #use screen.fill((RGB))
	<Update> #Call all update events for all sprites
	<Draw> # Call all draw events for all sprites and draw background.
	<Pause> # use pygame.time.wait(milliseconds). 10-20milliseconds should be good. Try more if not.

Drop the new code lines in place of the 'o.update' and 'o.draw' lines

Just ask if you need more help

SgtMe 46 Veteran Poster Featured Poster

may I recommend that, on the design side, you seperate the buttons into blocks...it just looks a bit neater.
Good work so far and good luck!

SgtMe 46 Veteran Poster Featured Poster

have a look at the system calculator...or just any sci-calculator

SgtMe 46 Veteran Poster Featured Poster

M+ is adding display to the memory
MR is recalling the memory. Ie: You do a sum and get the result 6.3322 and you need this for another sum. So, you press M+ to ad 6.3322 to the memory, then you type in the next sum. When you need 6.3322, you press the MR button, which insterts the current value of the memory (6.3322 in this case) into the display.
MC is obviously deleteing the contents of the memory (set to 0?).
I'm not sure about the difference between M+ and MS though...

Try looking at the system calculator...hope this helps!

SgtMe 46 Veteran Poster Featured Poster

Are you using 64-bit Python?
If so, this is likely to be the issue. Unfortunately, you will need to uninstall all the python modules you have and reinstall them on a 32-bit version of Python. Some modules such as Pygame and PyQt4 do not yet have support for 64-bit Python.

I am running 64-bit Windows 7 Home Premium with Python 2.6.4, and since I did this for pyGame, I have had no further issues.

SgtMe 46 Veteran Poster Featured Poster

You have two problems:
1. Your code is all over the place
2. Your binding everything to the same window.

1. With your class, you should call root = Tk() inside the __init__ function, this also means that root.mainloop() should go at the end of the __init__ function. Also, I would recommend reordering the code in a more logical order. Because all your functions are in a class, you can ignore the problem of having to declare a function before calling it.

2. You are using two frames, but they are on the same window - root. They will automatically be combined and placed inside the same window. If you want them to be seperate, I suggest having either a second full class (with __init__ function) or a seperate function. Within this, you should call root = Tk() again, to create another window. It may not be exactly what you want, but it'll do for now.

I am making a series of Python and Tkinter tutorials on youtube, including one of the use of classes. Here is my channel:
http://www.youtube.com/pyProgrammer96

I hope this helps. :)

SgtMe 46 Veteran Poster Featured Poster

I don't like IDLE. I was using netbeans but it got annoying, cos even if I wanted to test something small before I put it in a program, I had to make a new project. The only advantages of netbeans is that it shows typing errors as you go, and freezes any errors that come up so you don't have to print screen and paste in paint!

SgtMe 46 Veteran Poster Featured Poster

sorry vegaseat, but I use Notepad, NOT NOTEPAD++

Ich bin der MS-Noob

SgtMe 46 Veteran Poster Featured Poster

I always use the tab key. It just looks neater to me...

SgtMe 46 Veteran Poster Featured Poster

For a menu, just make a new function. Have it print out the choices on screen, including a number, and then the option is chosen by inputing a number. You could use the raw_input() function, but this is rather crude, as it throws errors, if it recieves a value that it does not have a statement for.

I suppose you could use an 'else' statement, which then starts the menu again. Try it and come back to me if you need more help.

SgtMe 46 Veteran Poster Featured Poster

Also, you may need header guards. Check out this thread (started by me - when I was more of a noob than I am now...).

http://www.daniweb.com/forums/thread238216.html

Hope it helps...
Mark

SgtMe 46 Veteran Poster Featured Poster

cppgameprogramming.com ( allegro )
cplusplus.com ( general C++ )
codeguru.com ( another forum though this one is better :} )

zobadof commented: Thanks! +0
SgtMe 46 Veteran Poster Featured Poster

maybe... it depends what you want to do. You can always learn them both side by side. I just find that setting up a window like that it pointless for simple graphics, when you can do it in 1 line for allegro... :icon_eek:

Oh BTW MattyRobot ich bin 13 too! ZOMG

SgtMe 46 Veteran Poster Featured Poster

I recommend that you start with simple graphics.
Head over to this site, and start on the allegro tutorials.

http://www.cppgameprogramming.com/cgi/nav.cgi?page=allegbasics

:icon_idea:


PS.

Double click anywhere on the site to bring up a menu to go onto the next tutorial.