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
4c2fab51
Commit
4c2fab51
authored
Feb 18, 1998
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation using TCLPROC loaded into the Tcl interpreter
parent
aeca79b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
10 deletions
+32
-10
Tools/pynche/StripViewer.py
Tools/pynche/StripViewer.py
+32
-10
No files found.
Tools/pynche/StripViewer.py
View file @
4c2fab51
...
...
@@ -3,6 +3,20 @@ from Tkinter import *
import
Pmw
import
ColorDB
# Load this script into the Tcl interpreter and call it in
# StripWidget.set_color(). This is about as fast as it can be with the
# current _tkinter.c interface, which doesn't support Tcl Objects.
TCLPROC
=
'''
\
proc setcolor {canv colors} {
set i 1
foreach c $colors {
$canv itemconfigure $i -fill $c -outline $c
incr i
}
}
'''
class
LeftArrow
:
_ARROWWIDTH
=
30
...
...
@@ -113,6 +127,10 @@ class StripWidget(Pmw.MegaWidget):
self
.
__canvas
.
bind
(
'<B1-Motion>'
,
self
.
__select_chip
)
# Load a proc into the Tcl interpreter. This is used in the
# set_color() method to speed up setting the chip colors.
self
.
__canvas
.
tk
.
eval
(
TCLPROC
)
# create the color strip
chips
=
self
.
__chips
=
[]
x
=
1
...
...
@@ -187,27 +205,31 @@ class StripWidget(Pmw.MegaWidget):
chip
=
0
chips
=
self
.
__chips
=
[]
tclcmd
=
[]
tk
=
self
.
__canvas
.
tk
for
t
in
self
.
__generator
(
self
.
__numchips
,
rgbtuple
):
rrggbb
=
ColorDB
.
triplet_to_rrggbb
(
t
)
chips
.
append
(
rrggbb
)
## self.__canvas.itemconfigure(i,
## fill=rrggbb,
## outline=rrggbb)
tclcmd
.
append
(
self
.
__canvas
.
_w
)
tclcmd
.
append
(
'itemconfigure'
)
tclcmd
.
append
(
`i`
)
tclcmd
.
append
(
'-fill'
)
tclcmd
.
append
(
rrggbb
)
tclcmd
.
append
(
'-outline'
)
tclcmd
.
append
(
rrggbb
)
tclcmd
.
append
(
'
\
n
'
)
##
tclcmd.append(self.__canvas._w)
##
tclcmd.append('itemconfigure')
##
tclcmd.append(`i`)
##
tclcmd.append('-fill')
##
tclcmd.append(rrggbb)
##
tclcmd.append('-outline')
##
tclcmd.append(rrggbb)
##
tclcmd.append('\n')
tred
,
tgreen
,
tblue
=
t
if
tred
<=
red
and
tgreen
<=
green
and
tblue
<=
blue
:
chip
=
i
i
=
i
+
1
# call the raw tcl script
script
=
string
.
join
(
tclcmd
,
' '
)
self
.
__canvas
.
tk
.
eval
(
script
)
## script = string.join(tclcmd, ' ')
## self.__canvas.tk.eval(script)
## colors = tk.merge(chips)
colors
=
string
.
join
(
chips
)
tk
.
eval
(
'setcolor %s {%s}'
%
(
self
.
__canvas
.
_w
,
colors
))
# get the arrow's text
coloraxis
=
rgbtuple
[
self
.
__axis
]
...
...
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