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
769e1085
Commit
769e1085
authored
Aug 03, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AttrDialog.py: some structural changes
listtree.py: "Print" -> "List" in description
parent
68680039
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
29 deletions
+45
-29
Demo/tkinter/guido/AttrDialog.py
Demo/tkinter/guido/AttrDialog.py
+44
-28
Demo/tkinter/guido/listtree.py
Demo/tkinter/guido/listtree.py
+1
-1
No files found.
Demo/tkinter/guido/AttrDialog.py
View file @
769e1085
...
@@ -100,18 +100,24 @@ class ReadonlyOption(Option):
...
@@ -100,18 +100,24 @@ class ReadonlyOption(Option):
def
addoption
(
self
):
def
addoption
(
self
):
self
.
label
=
Label
(
self
.
frame
,
self
.
label
=
Label
(
self
.
frame
,
{
'textvariable'
:
self
.
var
,
{
'textvariable'
:
self
.
var
,
'anchor'
:
'e'
,
Pack
:
{
'side'
:
'right'
}})
Pack
:
{
'side'
:
'right'
}})
class
Dialog
:
class
Dialog
:
def
__init__
(
self
,
master
):
def
__init__
(
self
,
master
):
self
.
master
=
master
self
.
master
=
master
self
.
fixclasses
()
self
.
refresh
()
self
.
refresh
()
self
.
top
=
Toplevel
(
self
.
master
)
self
.
top
=
Toplevel
(
self
.
master
)
self
.
top
.
title
(
self
.
__class__
.
__name__
)
self
.
top
.
title
(
self
.
__class__
.
__name__
)
self
.
top
.
minsize
(
1
,
1
)
self
.
top
.
minsize
(
1
,
1
)
self
.
addchoices
()
self
.
addchoices
()
def
refresh
(
self
):
pass
# Must override
def
fixclasses
(
self
):
pass
# May override
def
addchoices
(
self
):
def
addchoices
(
self
):
self
.
choices
=
{}
self
.
choices
=
{}
list
=
[]
list
=
[]
...
@@ -133,6 +139,11 @@ class Dialog:
...
@@ -133,6 +139,11 @@ class Dialog:
cl
=
self
.
stringoption
cl
=
self
.
stringoption
self
.
choices
[
k
]
=
cl
(
self
,
k
)
self
.
choices
[
k
]
=
cl
(
self
,
k
)
# Must override:
options
=
{}
classes
=
{}
# May override:
booleanoption
=
BooleanOption
booleanoption
=
BooleanOption
stringoption
=
StringOption
stringoption
=
StringOption
enumoption
=
EnumOption
enumoption
=
EnumOption
...
@@ -155,7 +166,8 @@ class PackDialog(Dialog):
...
@@ -155,7 +166,8 @@ class PackDialog(Dialog):
try
:
try
:
Pack
.
config
(
self
.
dialog
.
widget
,
Pack
.
config
(
self
.
dialog
.
widget
,
{
self
.
option
:
self
.
current
})
{
self
.
option
:
self
.
current
})
except
TclError
:
except
TclError
,
msg
:
print
msg
self
.
refresh
()
self
.
refresh
()
class
booleanoption
(
packoption
,
BooleanOption
):
pass
class
booleanoption
(
packoption
,
BooleanOption
):
pass
...
@@ -211,7 +223,7 @@ class RemotePackDialog(PackDialog):
...
@@ -211,7 +223,7 @@ class RemotePackDialog(PackDialog):
'newinfo'
,
'newinfo'
,
self
.
widget
))
self
.
widget
))
except
TclError
,
msg
:
except
TclError
,
msg
:
print
'send pack newinfo'
,
self
.
widget
,
':'
,
msg
print
msg
return
return
dict
=
{}
dict
=
{}
for
i
in
range
(
0
,
len
(
words
),
2
):
for
i
in
range
(
0
,
len
(
words
),
2
):
...
@@ -231,10 +243,14 @@ class RemotePackDialog(PackDialog):
...
@@ -231,10 +243,14 @@ class RemotePackDialog(PackDialog):
try
:
try
:
self
.
dialog
.
master
.
send
(
self
.
dialog
.
master
.
send
(
self
.
dialog
.
app
,
self
.
dialog
.
app
,
'pack'
,
'config'
,
self
.
dialog
.
widget
,
'pack'
,
'-'
+
self
.
option
,
self
.
current
)
'config'
,
self
.
dialog
.
widget
,
'-'
+
self
.
option
,
self
.
dialog
.
master
.
tk
.
merge
(
self
.
current
))
except
TclError
,
msg
:
except
TclError
,
msg
:
print
'send pack config ... :'
,
msg
print
msg
self
.
refresh
()
self
.
refresh
()
class
booleanoption
(
remotepackoption
,
BooleanOption
):
pass
class
booleanoption
(
remotepackoption
,
BooleanOption
):
pass
...
@@ -246,14 +262,17 @@ class WidgetDialog(Dialog):
...
@@ -246,14 +262,17 @@ class WidgetDialog(Dialog):
def
__init__
(
self
,
widget
):
def
__init__
(
self
,
widget
):
self
.
widget
=
widget
self
.
widget
=
widget
if
self
.
addclasses
.
has_key
(
self
.
widget
.
widgetName
):
self
.
klass
=
widget
.
winfo_class
()
Dialog
.
__init__
(
self
,
widget
)
def
fixclasses
(
self
):
if
self
.
addclasses
.
has_key
(
self
.
klass
):
classes
=
{}
classes
=
{}
for
c
in
(
self
.
classes
,
for
c
in
(
self
.
classes
,
self
.
addclasses
[
self
.
widget
.
widgetName
]):
self
.
addclasses
[
self
.
klass
]):
for
k
in
c
.
keys
():
for
k
in
c
.
keys
():
classes
[
k
]
=
c
[
k
]
classes
[
k
]
=
c
[
k
]
self
.
classes
=
classes
self
.
classes
=
classes
Dialog
.
__init__
(
self
,
widget
)
def
refresh
(
self
):
def
refresh
(
self
):
self
.
configuration
=
self
.
widget
.
config
()
self
.
configuration
=
self
.
widget
.
config
()
...
@@ -276,7 +295,8 @@ class WidgetDialog(Dialog):
...
@@ -276,7 +295,8 @@ class WidgetDialog(Dialog):
self
.
current
=
self
.
var
.
get
()
self
.
current
=
self
.
var
.
get
()
try
:
try
:
self
.
dialog
.
widget
[
self
.
option
]
=
self
.
current
self
.
dialog
.
widget
[
self
.
option
]
=
self
.
current
except
TclError
:
except
TclError
,
msg
:
print
msg
self
.
refresh
()
self
.
refresh
()
class
booleanoption
(
widgetoption
,
BooleanOption
):
pass
class
booleanoption
(
widgetoption
,
BooleanOption
):
pass
...
@@ -338,26 +358,25 @@ class WidgetDialog(Dialog):
...
@@ -338,26 +358,25 @@ class WidgetDialog(Dialog):
_tristate
=
{
'State'
:
(
'normal'
,
'active'
,
'disabled'
)}
_tristate
=
{
'State'
:
(
'normal'
,
'active'
,
'disabled'
)}
_bistate
=
{
'State'
:
(
'normal'
,
'disabled'
)}
_bistate
=
{
'State'
:
(
'normal'
,
'disabled'
)}
addclasses
=
{
addclasses
=
{
'
b
utton'
:
_tristate
,
'
B
utton'
:
_tristate
,
'
r
adiobutton'
:
_tristate
,
'
R
adiobutton'
:
_tristate
,
'
c
heckbutton'
:
_tristate
,
'
C
heckbutton'
:
_tristate
,
'
e
ntry'
:
_bistate
,
'
E
ntry'
:
_bistate
,
'
t
ext'
:
_bistate
,
'
T
ext'
:
_bistate
,
'
m
enubutton'
:
_tristate
,
'
M
enubutton'
:
_tristate
,
'
s
lider'
:
_bistate
,
'
S
lider'
:
_bistate
,
}
}
class
RemoteWidgetDialog
(
WidgetDialog
):
class
RemoteWidgetDialog
(
WidgetDialog
):
def
__init__
(
self
,
master
,
app
,
widget
):
def
__init__
(
self
,
master
,
app
,
widget
):
self
.
master
=
master
self
.
app
=
app
self
.
app
=
app
self
.
widget
=
widget
self
.
widget
=
widget
self
.
refresh
()
self
.
klass
=
master
.
send
(
self
.
app
,
self
.
top
=
Toplevel
(
self
.
master
)
'winfo'
,
self
.
top
.
title
(
self
.
app
+
' WidgetDialog'
)
'class'
,
self
.
top
.
minsize
(
1
,
1
)
self
.
widget
)
self
.
addchoices
(
)
Dialog
.
__init__
(
self
,
master
)
def
refresh
(
self
):
def
refresh
(
self
):
try
:
try
:
...
@@ -366,7 +385,7 @@ class RemoteWidgetDialog(WidgetDialog):
...
@@ -366,7 +385,7 @@ class RemoteWidgetDialog(WidgetDialog):
self
.
widget
,
self
.
widget
,
'config'
))
'config'
))
except
TclError
,
msg
:
except
TclError
,
msg
:
print
'send widget config'
,
self
.
widget
,
':'
,
msg
print
msg
return
return
dict
=
{}
dict
=
{}
for
item
in
items
:
for
item
in
items
:
...
@@ -376,10 +395,7 @@ class RemoteWidgetDialog(WidgetDialog):
...
@@ -376,10 +395,7 @@ class RemoteWidgetDialog(WidgetDialog):
dict
[
key
]
=
value
dict
[
key
]
=
value
self
.
configuration
=
dict
self
.
configuration
=
dict
self
.
update
()
self
.
update
()
self
.
current
[
'.class'
]
=
self
.
master
.
send
(
self
.
app
,
self
.
current
[
'.class'
]
=
self
.
klass
'winfo'
,
'class'
,
self
.
widget
)
self
.
current
[
'.name'
]
=
self
.
widget
self
.
current
[
'.name'
]
=
self
.
widget
class
remotewidgetoption
:
# Mix-in class
class
remotewidgetoption
:
# Mix-in class
...
@@ -393,7 +409,7 @@ class RemoteWidgetDialog(WidgetDialog):
...
@@ -393,7 +409,7 @@ class RemoteWidgetDialog(WidgetDialog):
'-'
+
self
.
option
,
'-'
+
self
.
option
,
self
.
current
)
self
.
current
)
except
TclError
,
msg
:
except
TclError
,
msg
:
print
'send widget config :'
,
msg
print
msg
self
.
refresh
()
self
.
refresh
()
class
booleanoption
(
remotewidgetoption
,
BooleanOption
):
pass
class
booleanoption
(
remotewidgetoption
,
BooleanOption
):
pass
...
...
Demo/tkinter/guido/listtree.py
View file @
769e1085
#
Prin
t a remote app's widget tree (names and classes only)
#
Lis
t a remote app's widget tree (names and classes only)
import
sys
import
sys
import
string
import
string
...
...
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