tkinter MVC

G

Gigs_

Can someone give me example how to write text editor in tkintter with
model-view-controler?
What goes to controler and what goes to model?



thanks in advance
 
E

Eric Brunel

Can someone give me example how to write text editor in tkintter with
model-view-controler?
What goes to controler and what goes to model?

thanks in advance

Others may have a different opinion, but I think using MVC to do a text
editor is a bit overkill. Basically, the only operation needed on the
model are reading and writing of the file, so a basic Python file object
will be OK. Considering that, and since the Tkinter Text widget is
basically already a full-featured text editor, the controller part is also
quite limited. You could do it however, but it would just be a matter of
moving the methods called by the bindings to a secondary class. If what
you're doing is just a text editor, it may not be worth the effort.

Having an MVC architecture for a text editor may be a good idea if the
file objects have to interact with other objects at a "functional" level,
i.e without any impact on the GUI. If what you're doing is only a text
editor, i.e only managing text files, the advantages of such an
architecture won't really show up...

My [$£€¥]0.02...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,122
Latest member
VinayKumarNevatia_
Top