Re: Ideal way to separate GUI and logic?

2013-07-15 Thread asimjalis
fron...@gmail.com wrote: So as a general idea, I should at the very least separate the GUI from the program logic by defining the logic as a function, correct? And the next level of separation is to define the logic as a class in one or more separate files, and then import it to the file

Re: Ideal way to separate GUI and logic?

2013-07-15 Thread fronagzen
On Tuesday, July 16, 2013 1:06:30 AM UTC+8, asim...@gmail.com wrote: fron...@gmail.com wrote: So as a general idea, I should at the very least separate the GUI from the program logic by defining the logic as a function, correct? And the next level of separation is to define the logic as

Re: Ideal way to separate GUI and logic?

2013-07-15 Thread Owen Marshall
On 2013-07-16, fronag...@gmail.com fronag...@gmail.com wrote: On Tuesday, July 16, 2013 1:06:30 AM UTC+8, asim...@gmail.com wrote: fron...@gmail.com wrote: So as a general idea, I should at the very least separate the GUI from the program logic by defining the logic as a function,

Re: Ideal way to separate GUI and logic?

2013-07-15 Thread Asim Jalis
On Mon, Jul 15, 2013 at 5:25 PM, fronag...@gmail.com wrote: Again, thanks for all the responses. I'm curious, though, what exactly is the rationale for making functions so small? (I've heard that the function calling of Python has relatively high overhead?) There is a small overhead, but it

Re: Ideal way to separate GUI and logic?

2013-07-15 Thread Chris Angelico
On Tue, Jul 16, 2013 at 10:25 AM, fronag...@gmail.com wrote: Again, thanks for all the responses. I'm curious, though, what exactly is the rationale for making functions so small? (I've heard that the function calling of Python has relatively high overhead?) A function should be as long as

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread fronagzen
Thanks for all the responses! So as a general idea, I should at the very least separate the GUI from the program logic by defining the logic as a function, correct? And the next level of separation is to define the logic as a class in one or more separate files, and then import it to the file

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread fronagzen
Thanks for all the responses! So as a general idea, I should at the very least separate the GUI from the program logic by defining the logic as a function, correct? And the next level of separation is to define the logic as a class in one or more separate files, and then import it to the file

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread Joel Goldstick
On Sun, Jul 14, 2013 at 8:25 PM, fronag...@gmail.com wrote: Thanks for all the responses! So as a general idea, I should at the very least separate the GUI from the program logic by defining the logic as a function, correct? And the next level of separation is to define the logic as a class

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread Roy Smith
In article mailman.4706.1373850127.3114.python-l...@python.org, Joel Goldstick joel.goldst...@gmail.com wrote: Writing code isn't all theory. It takes practice, and since the days of The Mythical Man-Month, it has been well understood that you always end up throwing away the first system

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread Steven D'Aprano
On Sun, 14 Jul 2013 17:25:32 -0700, fronagzen wrote: My next question is, to what degree should I 'slice' my logic into functions? How small or how large should one function be, as a rule of thumb? I aim to keep my functions preferably below a dozen lines (excluding the doc string), and

Ideal way to separate GUI and logic?

2013-07-13 Thread fronagzen
Well, I'm a newcome to Python, but I'm developing a program with a GUI in tkinter, and I'm wondering what is the best, 'most pythonic' way of doing this? I could, obviously, write a monolithic block of code. I can define the logic and the GUI as two separate classes and then call from those

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 04:07:21 -0700, fronagzen wrote: Well, I'm a newcome to Python, but I'm developing a program with a GUI in tkinter, and I'm wondering what is the best, 'most pythonic' way of doing this? I could, obviously, write a monolithic block of code. I can define the logic and

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Roland Koebler
Hi, But how then do I separate out the logic and the GUI? I usually write a library (C library, Python module, ...) which contains the logic. Then, I write a GUI (in a separate file), which imports and uses the library. If I need another UI (e.g. GUI with an other toolkit, or a text-based or

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Dave Cook
On 2013-07-13, fronag...@gmail.com fronag...@gmail.com wrote: I'm wondering what is the best, 'most pythonic' way I recommend PyPubsub: http://pubsub.sourceforge.net/ Dave Cook -- http://mail.python.org/mailman/listinfo/python-list

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Wayne Werner
On Sat, 13 Jul 2013, fronag...@gmail.com wrote: Well, I'm a newcome to Python, but I'm developing a program with a GUI in tkinter, and I'm wondering what is the best, 'most pythonic' way of doing this? I could, obviously, write a monolithic block of code. True, you could, but don't do that.