Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1dc5df12
Commit
1dc5df12
authored
Oct 01, 2001
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #426880: Implement Listbox itemcget and itemconfigure.
parent
f1f129f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
Lib/lib-tk/Tkinter.py
Lib/lib-tk/Tkinter.py
+25
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/lib-tk/Tkinter.py
View file @
1dc5df12
...
...
@@ -2299,6 +2299,31 @@ class Listbox(Widget):
i
=
self
.
tk
.
call
(
self
.
_w
,
'index'
,
index
)
if
i
==
'none'
:
return
None
return
getint
(
i
)
def
itemcget
(
self
,
index
,
option
):
"""Return the resource value for an ITEM and an OPTION."""
return
self
.
tk
.
call
(
(
self
.
_w
,
'itemcget'
)
+
(
index
,
'-'
+
option
))
def
itemconfigure
(
self
,
index
,
cnf
=
None
,
**
kw
):
"""Configure resources of an ITEM.
The values for resources are specified as keyword arguments.
To get an overview about the allowed keyword arguments
call the method without arguments.
Valid resource names: background, foreground,
selectbackground, selectforeground."""
if
cnf
is
None
and
not
kw
:
cnf
=
{}
for
x
in
self
.
tk
.
split
(
self
.
tk
.
call
(
self
.
_w
,
'itemconfigure'
,
index
)):
cnf
[
x
[
0
][
1
:]]
=
(
x
[
0
][
1
:],)
+
x
[
1
:]
return
cnf
if
type
(
cnf
)
==
StringType
and
not
kw
:
x
=
self
.
tk
.
split
(
self
.
tk
.
call
(
self
.
_w
,
'itemconfigure'
,
index
,
'-'
+
cnf
))
return
(
x
[
0
][
1
:],)
+
x
[
1
:]
self
.
tk
.
call
((
self
.
_w
,
'itemconfigure'
,
index
)
+
self
.
_options
(
cnf
,
kw
))
itemconfig
=
itemconfigure
def
insert
(
self
,
index
,
*
elements
):
"""Insert ELEMENTS at INDEX."""
self
.
tk
.
call
((
self
.
_w
,
'insert'
,
index
)
+
elements
)
...
...
Misc/NEWS
View file @
1dc5df12
...
...
@@ -15,6 +15,8 @@ Library
- quopri's encode and decode methods take an optional header parameter,
which indicates whether output is intended for the header 'Q' encoding.
- Tkinter.Listbox now exposes itemcget and itemconfigure.
Tools
Build
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment