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
f9c6ddc4
Commit
f9c6ddc4
authored
Oct 01, 1998
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
370a0837
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
0 deletions
+95
-0
Tools/pynche/TextViewer.py
Tools/pynche/TextViewer.py
+95
-0
No files found.
Tools/pynche/TextViewer.py
0 → 100644
View file @
f9c6ddc4
import
sys
from
Tkinter
import
*
from
pynche
import
__version__
import
ColorDB
class
TextViewer
:
def
__init__
(
self
,
switchboard
,
parent
=
None
):
self
.
__sb
=
switchboard
root
=
self
.
__root
=
Toplevel
(
parent
,
class_
=
'Pynche'
)
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
__withdraw
)
root
.
title
(
'Pynche %s'
%
__version__
)
root
.
iconname
(
'Pynche Text Window'
)
root
.
bind
(
'<Alt-q>'
,
self
.
__quit
)
root
.
bind
(
'<Alt-Q>'
,
self
.
__quit
)
#
# create the text widget
#
self
.
__text
=
Text
(
root
,
relief
=
SUNKEN
,
background
=
'black'
,
foreground
=
'white'
,
width
=
35
,
height
=
15
)
self
.
__text
.
pack
()
self
.
__text
.
insert
(
0.0
,
'''
\
Insert some stuff here and play
with the buttons below to see
how the colors interact in
textual displays.'''
)
#
# variables
self
.
__trackp
=
BooleanVar
()
self
.
__trackp
.
set
(
0
)
self
.
__which
=
IntVar
()
self
.
__which
.
set
(
4
)
#
# track toggle
self
.
__t
=
Checkbutton
(
root
,
text
=
'Track color changes'
,
variable
=
self
.
__trackp
,
relief
=
GROOVE
)
self
.
__t
.
pack
(
fill
=
X
,
expand
=
YES
)
frame
=
self
.
__frame
=
Frame
(
root
)
frame
.
pack
()
#
# labels
self
.
__labels
=
[]
row
=
2
for
text
in
(
'Text:'
,
'Selection:'
,
'Insertion:'
):
l
=
Label
(
frame
,
text
=
text
)
l
.
grid
(
row
=
row
,
column
=
0
,
sticky
=
E
)
self
.
__labels
.
append
(
l
)
row
=
row
+
1
col
=
1
for
text
in
(
'Foreground'
,
'Background'
):
l
=
Label
(
frame
,
text
=
text
)
l
.
grid
(
row
=
1
,
column
=
col
)
self
.
__labels
.
append
(
l
)
col
=
col
+
1
#
# radios
self
.
__radios
=
[]
val
=
0
for
col
in
(
1
,
2
):
for
row
in
(
2
,
3
,
4
):
# there is no insertforeground option
if
row
==
4
and
col
==
1
:
continue
r
=
Radiobutton
(
frame
,
variable
=
self
.
__which
,
value
=
(
row
-
2
)
*
2
+
col
-
1
)
r
.
grid
(
row
=
row
,
column
=
col
)
self
.
__radios
.
append
(
r
)
def
__quit
(
self
,
event
=
None
):
sys
.
exit
(
0
)
def
__withdraw
(
self
,
event
=
None
):
self
.
__root
.
withdraw
()
def
deiconify
(
self
,
event
=
None
):
self
.
__root
.
deiconify
()
def
__forceupdate
(
self
,
event
=
None
):
self
.
__sb
.
update_views_current
()
def
update_yourself
(
self
,
red
,
green
,
blue
):
colorname
=
ColorDB
.
triplet_to_rrggbb
((
red
,
green
,
blue
))
which
=
self
.
__which
.
get
()
if
which
==
0
:
self
.
__text
.
configure
(
foreground
=
colorname
)
elif
which
==
1
:
self
.
__text
.
configure
(
background
=
colorname
)
elif
which
==
2
:
self
.
__text
.
configure
(
selectforeground
=
colorname
)
elif
which
==
3
:
self
.
__text
.
configure
(
selectbackground
=
colorname
)
elif
which
==
5
:
self
.
__text
.
configure
(
insertbackground
=
colorname
)
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