I'm used to program with Python and GTK using pygtk library.
I feel like my programs are not well separated according to MVC model. I think following a framework it would help me to design better desktop applications.
I'd like to know which Python MVC framework for desktop apps you're using and why.
2 Answers 2
You don't need a framework. Create a class called Model
, another one called View
and a third one named Controller
and start coding. Put all of the UI code in the View
class, your data structures in the Model
class, and make sure they communicate only via the Controller
. I think going through that exercise might teach you a lot.
I'm not trying to be funny here, it's really not very complicated, and doesn't require a fancy framework.
-
1A single class in any container there is probably going to be a horrible practice given any nontrivial program.rlperez– rlperez2011年11月18日 04:06:54 +00:00Commented Nov 18, 2011 at 4:06
-
1Well, I'm not saying to create only three classes. That's just a starting point.Bryan Oakley– Bryan Oakley2011年11月18日 12:17:47 +00:00Commented Nov 18, 2011 at 12:17
first, I think Qt, and even it's Python bindings are way better structured than GTK; so you could first try it.
second, it seems you're slightly confused by the MVC buzzword. It was originally defined as a modular architecture for GUI applications; unfortunately, there's a completely different layered architecture for Web apps also called MVC.
Maybe you feel your desktop apps are not very MVC because there not very web MVC, but they might be very GUI MVC nonetheless.
-
1-1 for Qt. Not because I dislike it -- I've never used it -- but because a personal opinion on a choice of tool doesn't address the question being asked IMO. That, and toolkit wars, like editor wars, are so tiresome. Also -1 because this is the first time I've ever heard of "web mvc". To say there is somehow a distinction without giving any information to back that claim up isn't very useful.Bryan Oakley– Bryan Oakley2011年11月18日 01:33:43 +00:00Commented Nov 18, 2011 at 1:33
-
so you're downvoting because you don't know what i'm talking about, right?Javier– Javier2011年11月18日 01:56:39 +00:00Commented Nov 18, 2011 at 1:56
-
1@Javier: no, I'm down-voting because you said things that didn't make sense, and you didn't provide any facts or references to back up your statements. Bottom line: in my opinion, nothing in your answer is at all helpful to the person who asked the question. If you take the time to describe exactly how these two definitions of MVC are so completely different, your answer might be very enlightening and useful. As it stands, it's just adding to the confusion.Bryan Oakley– Bryan Oakley2011年11月18日 03:59:50 +00:00Commented Nov 18, 2011 at 3:59