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

Get path of file uploaded to Flask [duplicate]
How to load DICOM files in Python?
iPerf3 as a ssh.exec command using paramiko in Python
MemoryError when trying to append
Access the result of a previous calculation in custom function passed to apply()
multithreading: Second thread is waiting until first thread is finished
What determines the size of int in numpy?
sending html in django http response
SQLite not accepting unique command
How to run a Python package as a scheduled daemon job?
merge two tables when one table has key, but the other has only a range of the key
python mechanize: how can i make mechanize's submit() be able to open local HTML file?
Extracting Info From Specific Sub-elements Using ElementTree XML
Django delete old and new file before/after save new
How to make a response on the web using MQTT and Flask?
Four-of-a-Kind Dice Game

Categories

HOME
mql4
google-contacts
puppet
wxwidgets
label
reportportal
mapbox-gl-js
checksum
xtext
slim-3
android-viewpager
click
flexbox
keystore
image-recognition
gwtp
quartus
google-openid
movies
prestodb
ios10.3
pycrypto
koa
embedly
dspic
printdocument
non-deterministic
sumo
geopandas
jenkins-job-dsl
unpack
dss
ab-initio
i3
system.data.sqlite
nesc
cortex-m3
vertex-buffer
autofill
referenceerror
outsystems
spreedly
rhomobile
von-neumann
vsts-package-management
dart-pub
intellij-idea-2016
sendgrid-templates
xbim
stereo-3d
pytest-django
upsert
rdw
timesten
decompress
castle-dynamicproxy
jcreator
date-range
polar-coordinates
restivejs
rsqlite
android-navigationview
asteriskami
gradle-eclipse
mercurial-hook
squirrel
elastix
spinlock
post-processing
eml
except
persistence.xml
base32
playscape
ibm-data-studio
lexicographic
kallithea
mov
genetic-programming
proxies
cppdepend
ifft
lov
roxygen
pyjade
fogbugz-api
goinstant
entity-framework-4.1
justgage
mvs
pitch
plone-funnelweb
law-of-demeter
shared-objects
rubycas
adsl
ihttphandler
callgrind

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App