Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 053313a

Browse files
committed
Change to use keyword args instead of dicts
1 parent 8cf2db4 commit 053313a

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

Lib/lib-tk/ScrolledText.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@
1414
from Tkinter import _cnfmerge
1515

1616
class ScrolledText(Text):
17-
def __init__(self, master=None, cnf={}):
18-
cnf = _cnfmerge(cnf)
17+
def __init__(self, master=None, **cnf):
1918
fcnf = {}
20-
vcnf = {'name': 'vbar',
21-
Pack: {'side': 'right', 'fill': 'y'},}
2219
for k in cnf.keys():
2320
if type(k) == ClassType or k == 'name':
2421
fcnf[k] = cnf[k]
2522
del cnf[k]
26-
self.frame = Frame(master, fcnf)
27-
self.vbar = Scrollbar(self.frame, vcnf)
28-
cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
23+
self.frame = apply(Frame, (master,), fcnf)
24+
self.vbar = Scrollbar(self.frame, name='vbar')
25+
self.vbar.pack(side=RIGHT, fill=Y)
2926
cnf['name'] = 'text'
30-
Text.__init__(self, self.frame, cnf)
31-
self['yscrollcommand'] = (self.vbar, 'set')
32-
self.vbar['command'] = (self, 'yview')
27+
apply(Text.__init__, (self, self.frame), cnf)
28+
self.pack(side=LEFT, fill=BOTH, expand=1)
29+
self['yscrollcommand'] = self.vbar.set
30+
self.vbar['command'] = self.yview
3331

3432
# Copy Pack methods of self.frame -- hack!
3533
for m in Pack.__dict__.keys():

Lib/tkinter/ScrolledText.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@
1414
from Tkinter import _cnfmerge
1515

1616
class ScrolledText(Text):
17-
def __init__(self, master=None, cnf={}):
18-
cnf = _cnfmerge(cnf)
17+
def __init__(self, master=None, **cnf):
1918
fcnf = {}
20-
vcnf = {'name': 'vbar',
21-
Pack: {'side': 'right', 'fill': 'y'},}
2219
for k in cnf.keys():
2320
if type(k) == ClassType or k == 'name':
2421
fcnf[k] = cnf[k]
2522
del cnf[k]
26-
self.frame = Frame(master, fcnf)
27-
self.vbar = Scrollbar(self.frame, vcnf)
28-
cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
23+
self.frame = apply(Frame, (master,), fcnf)
24+
self.vbar = Scrollbar(self.frame, name='vbar')
25+
self.vbar.pack(side=RIGHT, fill=Y)
2926
cnf['name'] = 'text'
30-
Text.__init__(self, self.frame, cnf)
31-
self['yscrollcommand'] = (self.vbar, 'set')
32-
self.vbar['command'] = (self, 'yview')
27+
apply(Text.__init__, (self, self.frame), cnf)
28+
self.pack(side=LEFT, fill=BOTH, expand=1)
29+
self['yscrollcommand'] = self.vbar.set
30+
self.vbar['command'] = self.yview
3331

3432
# Copy Pack methods of self.frame -- hack!
3533
for m in Pack.__dict__.keys():

0 commit comments

Comments
 (0)