Just starting to get the idea of MVC with tkinter. I wrote this simple program and I'm looking for feedback. There are no errors, but I don't know if I set it up right or not.

import tkinter as tk

class Model():

    def __init__(self):
      self.list = ["email", "sms", 'voice']

class View(tk.Frame):
    def __init__(self, parent, controller):
        self.controller = controller
        tk.Frame.__init__(self, parent, bg="yellow", bd=2, 
        self.parent = parent

        self.output=tk.Label(self, textvariable=self.labelVariable, 
             bg="orange", fg="white")

        self.hello = tk.Button(self, text="Show", command= 
             self.controller.hello_Button_Pressed,  bd=2,            

class Controller():
    def __init__(self):
        self.root = tk.Tk()
        self.model = Model()
        self.view = View(self.root, self)

        self.root.title("MVC example")

    def hello_Button_Pressed(self):

if __name__ == '__main__':
    c = Controller()
  • \$\begingroup\$ Welcome to Code Review. Can you tell us more about what the code is supposed to do? Does the code have a purpose? I understand you want to learn about MVC, that's your goal. What's the goal of the code? \$\endgroup\$
    – Mast
    Dec 26, 2019 at 8:57
  • \$\begingroup\$ Hi @Mast, thanks for responding. This code is just to print the list onto the label. Nothing else. I could do this code without MVC, but to elevate my learning, i wanted to organize it with MVC. If this is correct, without much feedback, I will begin to rewrite most of my other programs into MVC, so any thoughts are welcomed. thanks again. \$\endgroup\$
    – fishtang
    Dec 26, 2019 at 9:19
  • \$\begingroup\$ Please edit the question to add the purpose of the code there. In the comment it is not visible enough. \$\endgroup\$ Feb 5, 2020 at 1:09

1 Answer 1


The code looks like it is set up fine for MVC. I'm not an expert but I have enogh experience to tell that it's fine.

  • \$\begingroup\$ thanks @Cruise Lickerman. it took me a while to understand the set up of MVC, and now I can start use it. \$\endgroup\$
    – fishtang
    Jan 6, 2020 at 20:04
  • \$\begingroup\$ Yeah took me a while also \$\endgroup\$
    – terrenana
    Jan 6, 2020 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.