How do I group all my functions in Python into one function? -


i using turtles module creating u.s. flag. user decides size of flag , size using create width , length.

i trying group/compress of subfunctions 1 huge function user can type draw_usaflag(t, w) ## t = turtle w = size , carry out task of 5 functions have.

for example have 2 subfunctions: draw_rectangle(t, w) , draw_stripes (t, w) ; want group these 2 subfunctions 1 function called draw_usaflag(t, w) use user inputted size (w) throughout of functions. appreciated! thanks!

quite simply, make function calls others:

def draw_rectangle(t, w):     #     ...  def draw_rectangle(t, w):     #     ...  def draw_usaflag(t, w):     draw_rectangle(t, w)     draw_stripes(t, w) 

this assumes don't return anything, whatever works side-effects on other object. if e.g. return image, need changing depending on exact structure of system.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -