Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
257a3287
Commit
257a3287
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
Add a super simple color correction client example
parent
2f1639c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/color-correction-ui.py
+47
-0
47 additions, 0 deletions
examples/color-correction-ui.py
with
47 additions
and
0 deletions
examples/color-correction-ui.py
0 → 100755
+
47
−
0
View file @
257a3287
#!/usr/bin/env python
#
# Simple example color correction UI.
# Talks to an fcserver running on localhost.
#
# Micah Elizabeth Scott
# This example code is released into the public domain.
#
import
Tkinter
as
tk
import
socket
import
json
import
struct
s
=
socket
.
socket
()
s
.
connect
((
'
localhost
'
,
7890
))
print
"
Connected to OPC server
"
def
setGlobalColorCorrection
(
**
obj
):
msg
=
json
.
dumps
(
obj
)
s
.
send
(
struct
.
pack
(
"
>BBH
"
,
0
,
0xF0
,
len
(
msg
))
+
msg
)
def
update
(
_
):
setGlobalColorCorrection
(
gamma
=
gamma
.
get
(),
whitepoint
=
[
red
.
get
(),
green
.
get
(),
blue
.
get
(),
])
def
slider
(
name
,
from_
,
to
):
s
=
tk
.
Scale
(
root
,
label
=
name
,
from_
=
from_
,
to
=
to
,
resolution
=
0.01
,
showvalue
=
'
yes
'
,
orient
=
'
horizontal
'
,
length
=
400
,
command
=
update
)
s
.
set
(
1.0
)
s
.
pack
()
return
s
root
=
tk
.
Tk
()
root
.
title
(
"
Fadecandy Color Correction Example
"
)
gamma
=
slider
(
"
Gamma
"
,
0.2
,
3.0
)
red
=
slider
(
"
Red
"
,
0.0
,
1.5
)
green
=
slider
(
"
Green
"
,
0.0
,
1.5
)
blue
=
slider
(
"
Blue
"
,
0.0
,
1.5
)
root
.
mainloop
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment