welcome to dynamo using Python to create
a user interface so in a previous video
I made a sheet using Python so I thought
I always extend this definition out and
create a user interface for the sheet so
I'm using the community version of
visual studios it has the ability to add
Python so the first thing that I'm going
to do is add a form which is a blank
slate of the windows system of form so
the next part that I need to do is add
the drawing from the system which will
allow me to use it as a paint kind of
canvas and then I'll go ahead and from
the system of windows of the form I'll
just import everything and then from the
system drawing I'll do the same and just
import everything that's in that
drawings and then I'll go ahead and
create a class and then I'll just go
ahead and create my window and I'll send
into the argument the form and then my
definition or my method I'll initiate it
and I'll just tell it it that it call it
itself so the first thing I want to do
is name my window which is now self and
I'll just say create window and I'll add
some text up at the top just the same
it's a be called create window and
you'll see it up at the top left and
then I'll size it because we're using
the drawing canvas so we'll just size it
to 500 by 150 and when it appears we'll
go ahead and center it onto the screen
that's always helpful
um and we'll set an empty array of
values that we can populate to send back
to Dynamo and I'll go ahead and create
my sheet name label and this is a just
the label and I'll just have this edit
the text in there that says a sheet name
and I'll go ahead and tell it that the
parent or where I'm sending it to is the
cell for the window and then from the
label I'll set the location of it at a
point of thirty ten which sometimes a
little bit difficult and a little test
trial you have to to set it up I'll go
ahead and just copy it again and just
call this one number four for my sheet
number and I'll just copy that over I'll
move it down in the in the the first
value is the X and the next value is the
Y so I'll move it down in the Y value
down to 50 and then I'll go ahead and
create the actual text boxes that will
send in the user information here and
I'll send in the the text box to
generate it a new new text box and then
I'll send it to to the parent which will
be my window and then I'm going to add a
initial text in there you can leave it
empty I'm just kind of showing this
which will say sheet name so the user
will see already something populated in
there and then again I'll have to put it
on my canvas using the drawing so this
will be the point where I put it
I'll put it 150 30 and that's X Y value
and then I'll generate another one for
the number so I'll just copy and paste
because you know sometimes you're you're
trying to do things quickly so just
quickly copy and paste things over here
and then I'll go ahead and add the
number
just put it right below so it'll be just
150 and then 50 to match my label and
then what I want to generate a button so
this is the method for the button and
then now my new button will be added to
the self which is my window and then
I'll just label it as okay so we know
the user sees it will see and okay when
it wants to send stuff in or when it
clicks it when they click it and then
again I'll use the the the drawing and
I'll just put it somewhere on my canvas
and then I want to register it or given
an event so when when they you know
click it I will I will send that the
button click and then I'll go ahead and
add a new method for for the event of my
click and also send in myself for the
window you the the sender which is the
the action and then the arguments which
which is um kind of difficult to do with
to understand but it's it's the catch of
all the list of programmable items in
kind of a long list that you send into
to this action and then from there I'll
go ahead and add my values that the user
sent and I'll append them and add them
to my empty list which I grabbed at the
beginning and then I'll go ahead and
close this off the the program so this
is a little bit of tidying up I'm a
little bit I like clean code things to
stack right and when somebody comes in
and looks at my code I like it I like it
to look clean so I go ahead and fast
forward through this nobody needs to sit
through and watch me clean all this up
but it is nice to just keep keep very
very tidy
odhh and the last thing that I'll do is
I'll send in a boolean value to get this
form started set it to true and then
it'll create a window and send back my
form and then the application will go
ahead and just start run my form and
then at the very end I want to send out
my my values which was the list that I
appended up there so that's it
so that about as easy as it gets
I'll just gonna copy copy this and I'll
paste it right into the IDE of a dynamo
it fails a great part about this I'll
give you some information you kind of
have to sift through it look down and
noticing that so something about Window
System so kind of that's kind of how you
debug you look through the things and oh
here we go windows out window typos it
was up to the ID what it caught that but
it didn't so we just copy and paste it
right back in there and then here's our
window we put in our new sheet go ahead
and give it a name we'll hit OK and
it'll generate that new sheet for us so
thank you if you have any ideas or
something you'd like to learn from
Python go ahead and put it in the
comments thank you for watching