This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# will need to be tweaked for your project | |
make_minimum_required(VERSION 3.5) | |
project(test_ros_pb11) | |
# Default to C99 | |
if(NOT CMAKE_C_STANDARD) | |
set(CMAKE_C_STANDARD 99) | |
endif() | |
# Default to C++14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def say_my_name(name): | |
""" | |
Print the current widget value in short sentence | |
""" | |
print(f'My name is {name}') | |
widgets.interact(say_my_name, name=["Jim", "Emma", "Bond"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib widget | |
import ipywidgets as widgets | |
import matplotlib.pyplot as plt | |
import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def say_my_name(name): | |
""" | |
Print the current widget value in short sentence | |
""" | |
print(f'My name is {name}') | |
widgets.interact(say_my_name, name=["Jim", "Emma", "Bond"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def say_something(x): | |
""" | |
Print the current widget value in short sentence | |
""" | |
print(f'Widget says: {x}') | |
widgets.interact(say_something, x=[0, 1, 2, 3]) | |
widgets.interact(say_something, x=(0, 10, 1)) | |
widgets.interact(say_something, x=(0, 10, .5)) | |
_ = widgets.interact(say_something, x=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def three(x, y, z): | |
return (x, y, z) | |
_ = widgets.interact( | |
three, | |
x=(0, 10, 1), | |
y=True, | |
z=['a', 'b', 'c'] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = widgets.interact( | |
three, | |
x=(0, 10, 1), | |
y=True, | |
z=widgets.fixed('I am fixed') | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@widgets.interact(x=(0, 10, 1)) | |
def foo(x): | |
""" | |
Print the current widget value in short sentence | |
""" | |
print(f'Slider says: {x}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set up plot | |
fig, ax = plt.subplots(figsize=(6, 4)) | |
ax.set_ylim([-4, 4]) | |
ax.grid(True) | |
# generate x values | |
x = np.linspace(0, 2 * np.pi, 100) | |
def my_sine(x, w, amp, phi): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
widgets.Textarea( | |
'\n'.join([w for w in dir(widgets) if not w.islower()]), | |
layout=widgets.Layout(height='200px') | |
) |
OlderNewer