Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
67cbcd2f
Commit
67cbcd2f
authored
Aug 21, 2011
by
Alexander Mordvintsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work on demo.py: sample running
parent
0de8ed10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
demo.py
samples/python2/demo.py
+17
-4
No files found.
samples/python2/demo.py
View file @
67cbcd2f
...
...
@@ -3,6 +3,7 @@ from ScrolledText import ScrolledText
from
glob
import
glob
from
common
import
splitfn
import
webbrowser
from
subprocess
import
Popen
#from IPython.Shell import IPShellEmbed
#ipshell = IPShellEmbed()
...
...
@@ -70,15 +71,19 @@ class App:
self
.
samples
[
name
]
=
fn
demos_lb
.
bind
(
'<<ListboxSelect>>'
,
self
.
on_demo_select
)
self
.
cmd_entry
=
cmd_entry
=
tk
.
Entry
(
right
)
run_btn
=
tk
.
Button
(
right
,
command
=
self
.
on_run
,
text
=
'Run'
,
width
=
8
)
self
.
text
=
text
=
ScrolledText
(
right
,
font
=
(
'arial'
,
12
,
'normal'
),
width
=
30
,
wrap
=
'word'
)
text
.
pack
(
fill
=
'both'
,
expand
=
1
)
self
.
linker
=
linker
=
LinkManager
(
text
,
self
.
on_link
)
self
.
text
.
tag_config
(
"header1"
,
font
=
(
'arial'
,
14
,
'bold'
))
self
.
text
.
tag_config
(
"header2"
,
font
=
(
'arial'
,
12
,
'bold'
))
text
.
config
(
state
=
'disabled'
)
text
.
pack
(
fill
=
'both'
,
expand
=
1
,
side
=
tk
.
BOTTOM
)
cmd_entry
.
pack
(
fill
=
'x'
,
side
=
'left'
,
expand
=
1
)
run_btn
.
pack
()
def
on_link
(
self
,
url
):
print
url
webbrowser
.
open
(
url
)
...
...
@@ -89,13 +94,16 @@ class App:
loc
=
{}
execfile
(
fn
,
loc
)
descr
=
loc
.
get
(
'__doc__'
,
'no-description'
)
self
.
linker
.
reset
()
self
.
text
.
config
(
state
=
'normal'
)
self
.
text
.
delete
(
1.0
,
tk
.
END
)
self
.
format_text
(
descr
)
self
.
text
.
config
(
state
=
'disabled'
)
self
.
cmd_entry
.
delete
(
0
,
tk
.
END
)
self
.
cmd_entry
.
insert
(
0
,
fn
)
def
format_text
(
self
,
s
):
text
=
self
.
text
lines
=
s
.
splitlines
()
...
...
@@ -129,6 +137,11 @@ class App:
else
:
text
.
tag_add
(
tag_proc
,
match_index
,
end_index
)
def
on_run
(
self
):
cmd
=
self
.
cmd_entry
.
get
()
print
'running:'
,
cmd
Popen
(
cmd
,
shell
=
True
)
def
run
(
self
):
tk
.
mainloop
()
...
...
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