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

Make a simple audio player with a playback control with gstreamer1.0 and gtk3
error in writing a text file in python [closed]
ipython using 2.6 version instead of 2.7
Django: How to override authenticate() method?
Execute python script with a variable from linux shell
Output loop result into a list
Pyinstaller will create an executable with --onefile, but not without it
PyMongo update multiple records with multiple data
How to automatically input ssh private key passphrase with pexpect
Extract only the portion of a string between two regex patterns
Filtering dictionary keys by a function of their associated values
webrtc without a browser
Simple python IF statement not working?
Python: aliased to python3
replacing certain expressions in file but only one time
why recompile python after lib devels installed?

Categories

HOME
xbox-live
semantic-ui
answer-set-programming
winapi
wmic
steam
otrs
deep-linking
zend-framework2
flyway
console
tumblr
eval
onenote-api
gimp
dryioc
line-api
scenebuilder
session-timeout
movies
mousewheel
multiple-columns
jni
esql
compare-and-swap
dpi
mangodb
dd-wrt
bxslider
gpib
protobuf-net
superpowered
viewstate
honeysql
hashcat
mmdrawercontroller
nlb
wfp
nodeclipse
readfile
dql
topic-modeling
wcf-security
nsexception
ical-dotnet
mediawiki-extensions
worker
rapidweaver
proof
defold
appstore-approval
broadcast
keycode
verbose
aescryptoserviceprovider
json-schema-validator
try-finally
bacnet
nofollow
linkageerror
metalsmith
string-parsing
search-regex
sun-codemodel
android-cursoradapter
intellitest
wikitext
qbfc
subresource-integrity
twython
crash-dumps
ibm-data-studio
code-first-migrations
virus
consensus
magento-1.12
sqoop2
multipleselection
lexicographic
belongs-to
cpu-speed
fragment-tab-host
livechat
jstat
planetary.js
phpdocx
uipickerviewcontroller
svcutil.exe
bigint
execvp
jqmobi
cgimageref
adomd.net
android-4.0
code-conversion
qsqltablemodel
vim-powerline
ubuntu-11.04
nsindexpath
dcpu-16
hardware-acceleration
longjmp
method-signature
system-codedom-compiler
outlook-form
rd





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