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

Handling streaming data that gets saved in a file in python
Parsing XML column in SQL Alchemy results
Result wasn't printing, why is `print` ignored after `return`?
PySpark to MySQL Insert Error?
How to auto check dynamic data json and post it
IndexError: list index out of range - Odoo v8 to Odoo v10 community
Appending a Linklist Node to a queue
longest time lazy flappy bird can survive - consecutive gap between 2 arrays
Return outside of function gives an error but print works fine
Combine two tables only when 3 similar values using pandas python
Sockets python client
python requests return a different web page from browser or urllib
Does Pyspark ML KMean have a way to get the explained variance?
Showing total on stacked bar Plotly
Traversal through a string with a loop in Python [duplicate]
Inline block not working with Python Django

Categories

HOME
checkbox
uibutton
visual-studio-2013
survival-analysis
laravel-4
proguard
google-classroom
x11
ssr
cratedb
line-api
cross-platform
mule-studio
rhapsody
zoomcharts
saiku
jogl
ip-camera
android-fragmentactivity
os161
logarithm
java-ee-7
onesignal
upnp
forum
dd-wrt
cell-array
superscript
jboss5.x
gpib
vegan
referenceerror
svnkit
percentage
spring-profiles
outsystems
edb
idl
body-parser
node-horseman
discord.net
dql
silverlight-3.0
common.logging
react-native-router-flux
bing-translator-api
finite-element-analysis
email-parsing
estimation
bnd
maintenance
createobject
master
ruby-2.0
spoofing
nssplitview
contour
selecteditem
distribute
spinlock
usb-drive
axes
twitter-rest-api
coypu
obfuscar
django-1.6
symfony-2.6
cloudpebble
gmaps4rails
gyroscope-framework
mov
neoload
svcutil.exe
winrt-httpclient
visual-c++-2010-express
cling
loop-invariant
onselect
goinstant
awesomeprint
maven-ear-plugin
linkedhashset
getusermedia
getstring
v4l
executable-format
adobe-contribute
pivotal-crm
squeel
pureftpd
interface-design
cots

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