python


tkinter Model-View-Controller: deeply-nested widgets calling the controller


I'm refactoring a tkinter GUI along a MVC design pattern. The Controller module imports a View class, and the View class makes requests to the Controller. I have a few ways of registering a change to an entry widget (StringVar trace, binding, etc.), but what if the widget is deeply nested and the callback is at a much higher level? What is the best way to have a request propagate upwards? For example, what if the View has a Frame that has a Frame that has a Widget that changes status?
The two solutions that occur to me are:
Russian Doll approach: Every inner layer is instantiated with either a reference to the View or the Controller, so the widget can directly make a request (e.g. to ViewReference.call_controller(input), or ControllerAlias.request(input). This leaves a trail of breadcrumbs from View to widget.
Family Tree approach: recursively call the parents and ask if they have an "ask controller to do thing" method. If not, ask their parents. This seems more fragile and awkward.


Related Links

While loop incrementer not functioning properly
How to trace what cause “IndexError: list index out of range” and how to find prod(column)?
Dynamically generate Flask routes
Python pint module with multiprocessing
Q: google app engine app.yaml how to handle urls from within main.py?
How to identify groups of three identical numbers in a list [duplicate]
get the length from last 2 columns in python
Tkinter change data
Python 3.5: Normalize array results in TypeError
Django model is not iterable in template
Can't read from serial device
To access the list object of outer class in the inner class in python
How can I fix these errors when I run manage.py
Creating new matrix from dataframe and matrix in pandas
Flask-Restless & Marshmallow: 'dict' object has no attribute '_sa_instance_state'
using undetermined number of parameters in scipy function curve_fit

Categories

HOME
sidekiq
jenkins-plugins
sass
mql4
filterrific
blockchain
qpython3
hyperledger-fabric
yocto
schemacrawler
desktop
postmessage
cloudflare
sendkeys
jcl
zend-framework-mvc
aws-cognito
jni
statusbar
excel-2010
apple-tv
os161
facebook4j
tcpclient
http-method
non-deterministic
bus-error
cgal
google-api-dotnet-client
vertex-buffer
skygear
mapguide
autocompletetextview
zero
coreclr
elfinder
freetts
installshield-2012
intellij-idea-2016
sendgrid-templates
knockout-3.0
stereo-3d
homekit
mod-fcgid
facebook-chatbot
encapsulation
estimation
aqgridview
drawingarea
openh264
adler32
festival
efxclipse
inject
uistackview
c#-interactive
chessboard.js
tuxedo
freetype2
django-filer
achievements
string-parsing
sonarqube5.3
throughput
intellitest
oai
mptcp
subversion-edge
es2015
adodb
left-recursion
jquery-autocomplete
getimagedata
code-testing
ssms-addin
unison
bounds
sqljdbc
bfd
bignum
driver-signing
multiple-conditions
xslkey
magickwand
sequelpro
vim-powerline
gjs
file-exists
hobo
flexicious
msgbox
nsindexpath
paintcomponent
search-path
getresource
open-graph-beta
iphone-sdk-3.2
swfloader
usability-testing
rd





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android


MS Developer
developer works
python
ios
c
html
jquery


RDBMS discuss