As I said before im new to python and stink at math(great combination huh?)

Well I've looked at Thinking in Tkinter but I still don't fully understand the concept of classes.

Could you provide any help\tutorials on this subject?

Help Appreciated :cheesy:

This is a nice beginners tutorial and has a decent section on classes in it:
http://www.byteofpython.info/

As the complexity of your programs increase, classes come handy. In simple words, a class groups functions together and gives the functions (now called methods) additional idendity, a way to pass parameters amongst themselves and a unified way to access parameters from outside the class. One class can inherit from another class without having to rewrite a lot of code.

I know this is a mouthful, but is something you start doing, as you advance in your programming skills.

BTW, nobody stinks at math! I thought I did, until I met the right inspiring teacher! It's tough to find a motivating math teacher when he or she make barely enough money to survive.

Heh. Nobody understands classes the first time around. When I was learning this stuff in Java, it took me about six months and 10+ OO* programs before I fully grokked what I was doing.

Reading up on classes is great, but if you really want to understand them, you have to use them. Many colleges put assignment specs for their computer science intro courses on the web for all to see, and often, these assignments are stripped down to illuminate a specific feature of classes or objects. You could try grabbing these specs and implementing the assignments in Python.

* OO: Object-oriented: describes programs which work by the manipulation of classes and objects.

I too am struggiling a with classes. all of those self.sometihings just mix me up. should I base my class on object or nothing. I figure if I keep trying to use them, someday it will just make sence. The previous are not questions I want answered, just making a point about my confusion.

So there is no code needed to share things between classes? (no global or anything?)

So there is no code needed to share things between classes? (no global or anything?)

As in, lets say:

I have two classes and there is a button in one and something happens in the other. And the two things reside in two different frames. There isn't any code that I have to put wherever is there?

I too am struggiling a with classes. all of those self.sometihings just mix me up. should I base my class on object or nothing. I figure if I keep trying to use them, someday it will just make sence. The previous are not questions I want answered, just making a point about my confusion.

Check the code snippet at:
http://www.daniweb.com/code/showsnippet.php?codeid=354
It talks about class inheritance and sheds some light on object and self.

As in, lets say:

I have two classes and there is a button in one and something happens in the other. And the two things reside in two different frames. There isn't any code that I have to put wherever is there?

You can write one class within the other, have one class inherit the other class for instance Frame2(Frame1), or simply reference a method from the other class properly with the dot convention for instance Frame1.method3().

Give me a simple example code and I play with it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.