Closed marc-frank closed 7 months ago
Hi Marc, ... super - thanks!
I made some changes to your request to adapt it to the special framework concept (sorry ;-):
Instead of using a checkbox, I took a button. The user will still be able to move the tangent points via mouse. So disabling the input fields wouldn't be enough ...
self.add(Button_Widget (self,r,1, lab='Set elliptical', width=110, columnspan=2,
style=SUPTLE, set=self.set_elliptical, padx=2, pady=(5,15)))
The buttons calls back a local proxy method which handles the changes. I do not use the tkinter 'active variables'. So the widgets have to be updated by a push refresh call.
def set_elliptical (self):
""" set bezier planform t be elliptical"""
self.planform().set_elliptical() # the 'logic' is handled in model object Planform_Bezier
self.refresh () # refresh all widgets of self (push)
fireEvent (self.ctk_root, CHORD_CHANGED) # refresh diagram (separated from edit frames)
The Bezier 'set to elliptical' is done in the model
def set_elliptical (self):
""" sets the tangents so that planform becoms elliptical """
# see https://stackoverflow.com/questions/14169234/the-relation-of-the-bezier-curve-and-ellipse
tangent_length = 0.55228474983
self.set_tangentLength_root(tangent_length)
self.set_tangentLength_tip(tangent_length)
self.set_tangentAngle_root(0)
That's it ...
As stated here https://stackoverflow.com/questions/14169234/the-relation-of-the-bezier-curve-and-ellipse when
tangent_length = 0.55228474983
, a bezier curve closely matches an ellipse.This can be useful for planform design and with this checkbox, the value doesn't have to be entered manually.
It also locks the Field_Widgets to protect against accidental modification. The Field_Widgets can be unlocked again, by unchecking the checkbox.