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

breaking up a list entry in several lists at every /n Python 3
How can I get the default colors in GTK?
Ndb entry .put() not executed?
Tensorflow: NaNs propagating throughout network, even though using sparse_softmax etc
How to do a Python argparse mutually required argument group
scaling websocket game application server
Is there a way to find a character's Unicode code point in Python 2.7?
figtext datetime function matplotlib
environment variable in ubuntu
Cross-platform Python Executables
Extract subarray from collection of 2D coordinates?
tkinter populate treeview using threading pool
How to make a function determining the winner of Tic-Tac-Toe more concise
Django update model entry using form fails
ctypes using HRESULT(python)
How to export property values with django-import-export

Categories

HOME
visual-studio-2015
signalr
meshlab
itext
drupal-7
warnings
steam
cocos2d-x-3.0
angular2-directives
zend-framework2
apache2
apiconnect
facebook-javascript-sdk
oclint
public-key-encryption
sign
symfony2-easyadmin
postmessage
titan
bootstrap-popover
bar-chart
zoomcharts
cython
esql
apple-tv
thingsboard
spring-ws
multiplayer
binutils
metadata-extractor
ab-initio
blackboard
red-black-tree
body-parser
large-data
wfp
pmwiki
forecasting
readfile
discord.net
silverlight-3.0
wcf-security
tango
z3py
bnd
hpcc
iphone-developer-program
polar-coordinates
objloader
push-diffusion
pydio
mongoose-populate
uiprogressview
mercurial-hook
coordinate-transformation
gmsmapview
remoteapp
portfolio
android-recyclerview
difference
datainputstream
getrusage
ninject.web.mvc
vips
mirrorlink
app.xaml
lmfit
mptcp
rx-groovy
sparse-file
web-component-tester
c++-actor-framework
cloudpebble
cocoascript
code-testing
aquafold
indexing-service
mbox
openkinect
arangodb-php
magicalrecord-2.2
apache2.2
qtgui
abnf
angularjs-timeout
dropdownlistfor
pstree
concurrent-programming
entity-framework-ctp5
charts4j
testunit
ihttphandler
ets
rijndael
callgrind
longjmp
gears

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