Skip to content

Commit

Permalink
Update advanced_example.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Akascape authored May 20, 2023
1 parent 0ca703c commit 77643e5
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions examples/advanced_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,19 @@ def add_effect(effect):
""" node operations """
global x
def image_modify(img, value):
if effect=="Brightness":
mode = ImageEnhance.Brightness(img)
elif effect=="Contrast":
mode = ImageEnhance.Contrast(img)
elif effect=="Sharpness":
mode = ImageEnhance.Sharpness(img)
elif effect=="Color":
mode = ImageEnhance.Color(img)
try:
if effect=="Brightness":
mode = ImageEnhance.Brightness(img)
elif effect=="Contrast":
mode = ImageEnhance.Contrast(img)
elif effect=="Sharpness":
mode = ImageEnhance.Sharpness(img)
elif effect=="Color":
mode = ImageEnhance.Color(img)

return mode.enhance(sliders[value].get())
except AttributeError: None

return mode.enhance(sliders[value].get())

value = x
node = NodeOperation(canvas, inputs=1, text=effect, command=lambda img: image_modify(img, value),
click_command=lambda: show_current_slider(node, value))
Expand All @@ -86,7 +88,6 @@ def show_image(output):
img = customtkinter.CTkImage(output, size=(label_height, label_height*ratio))
image_label.configure(image=img)


menu = NodeMenu(canvas) # right click or press <space> to spawn the node menu
menu.add_node(label="Media Import", command=input_media)
menu.add_node(label="Media Out", command=lambda: NodeCompile(canvas, text="MediaOut", show_value=None, command=show_image))
Expand Down

0 comments on commit 77643e5

Please sign in to comment.