An example of MVP (Model-View-Presenter) pattern implementation with Python Tkinter.
python main.py
---
title: Tk MVP
---
classDiagram
direction TB
class PresenterInterface {
<<interface>>
on_click()
on_select(float)
}
class Presenter {
model: Model
view: ViewInterface
Presenter(Model, ViewInterface)
on_click()
on_select(float)
}
class ViewInterface {
<<interface>>
setup(PresenterInterface)
set_value(float)
get_value() float
}
class View {
root: tk.Tk
presenter: PresenterInterface
View(tk.Tk)
setup(PresenterInterface)
set_value(float)
get_value() float
}
class Model {
data: float
set_data(float)
get_data() float
}
PresenterInterface <.. View : Use
ViewInterface <|.. View : Implementation
ViewInterface <.. Presenter : Use
PresenterInterface <.. ViewInterface : Use
PresenterInterface <|.. Presenter : Implementation
Model --o Presenter : Aggregation