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
c252d9bc
Commit
c252d9bc
authored
Dec 13, 2008
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #3767: Convert Tk object to string in tkColorChooser.
parent
afb0daba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
Lib/lib-tk/tkColorChooser.py
Lib/lib-tk/tkColorChooser.py
+7
-5
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/lib-tk/tkColorChooser.py
View file @
c252d9bc
...
...
@@ -34,19 +34,22 @@ class Chooser(Dialog):
try
:
# make sure initialcolor is a tk color string
color
=
self
.
options
[
"initialcolor"
]
if
type
(
color
)
==
type
(()
):
if
isinstance
(
color
,
tuple
):
# assume an RGB triplet
self
.
options
[
"initialcolor"
]
=
"#%02x%02x%02x"
%
color
except
KeyError
:
pass
def
_fixresult
(
self
,
widget
,
result
):
# result can be somethings: an empty tuple, an empty string or
# a Tcl_Obj, so this somewhat weird check handles that
if
not
result
or
not
str
(
result
):
return
None
,
None
# canceled
# to simplify application code, the color chooser returns
# an RGB tuple together with the Tk color string
if
not
result
:
return
None
,
None
# canceled
r
,
g
,
b
=
widget
.
winfo_rgb
(
result
)
return
(
r
/
256
,
g
/
256
,
b
/
256
),
result
return
(
r
/
256
,
g
/
256
,
b
/
256
),
str
(
result
)
#
...
...
@@ -66,5 +69,4 @@ def askcolor(color = None, **options):
# test stuff
if
__name__
==
"__main__"
:
print
"color"
,
askcolor
()
Misc/NEWS
View file @
c252d9bc
...
...
@@ -109,6 +109,8 @@ Core and builtins
Library
-------
-
Issue
#
3767
:
Convert
Tk
object
to
string
in
tkColorChooser
.
-
Issue
#
4342
:
Always
convert
Text
.
index
result
to
string
.
-
Issue
3248
:
Allow
placing
ScrolledText
in
a
PanedWindow
.
...
...
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