Re: [Tutor] Shortening the code of a finsihed program.

2011-11-24 Thread Alan Gauld
On 24/11/11 16:20, Mic wrote: and then try to put these parts togheter into a large program, I decided to post my entire program. Its usually better to paste long programs into a pastebin web site and give us a link. This saves cluttering up people mail with long messages, and also the paste

Re: [Tutor] How to shorten this code using classes?

2011-11-24 Thread Alan Gauld
On 23/11/11 17:09, James Reynolds wrote: However, as far as your question. For the two functions, you could subclass Button and add them to your new Button object: (untested) class MyButton(Button): button_color="green" button_value=False But I'd move these into __init__() since o

[Tutor] Shortening the code of a finsihed program.

2011-11-24 Thread Mic
Good afternoon! I have previously asked questions about how I can shorten my code. I have recieved a lot of good answers, but there is one thing that never works. I can never implement the suggestions into my code, and that is my fault. I have in my previous questions only asked how to shorte

Re: [Tutor] basic class loading question

2011-11-24 Thread Karim Meiborg
Cranky Frankie wrote: > OK, but this is still not working: > > class Qb: > def __init__(self, first_name='', last_name='', phone='', > email='', stadium=''): > self.first_name = first_name > self.last_name = last_name > self.phone = phone > self.email = email >

Re: [Tutor] How to shorten this code using classes?

2011-11-24 Thread Peter Otten
Mic wrote: >>I chose to ignore the "using classes" part. If you like you can turn the >>button_clicked() function into a method of a subclass of Button. You can >>also move the Button configuration done in create_widgets() into the >>__init__() method of that subclass. > > import tkinter as tk >