Confusion about create()
function
#15
gregnordin
started this conversation in
General
Replies: 2 comments 1 reply
-
If you copy the contents of an example to a new file and then add the
following, it should work:
create().appendTo(ltk.find("body"))
…On Wed, Nov 27, 2024, 10:32 PM Greg Nordin ***@***.***> wrote:
@laffra <https://github.com/laffra> I'm very interested in ltk but as I
try it I believe I am missing something fundamental. Specifically, in the
examples, each file has a create() function. I don't understand how
create() is used for a given example.
For example, when I look through the code that generates
https://pyscript.github.io/ltk/, I see instances of .create() in the
examples.__init__.py file in the items list. When examples is imported, I
understand that the code in __init__.py will be executed and therefore
each .create() function will be called, returning whatever ltk things it
creates. But I don't understand how these are populated in the relevant
tabs.
Alternatively, if I take the code from a specific example file and try to
use it in my own simple index.html file (with pyscript, ltk, etc.
properly loaded in the file), I don't know where I should call the
create() function, and things I have tried have resulted in errors. Any
clarification you can provide would be much appreciated. Thanks!
—
Reply to this email directly, view it on GitHub
<#15>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4XAKEO7LITTCF65MFUZHL2CY3AJAVCNFSM6AAAAABSTYHR62VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGU3DOOJQGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
👍
…On Wed, Nov 27, 2024 at 10:53 PM Greg Nordin ***@***.***> wrote:
Ahh, that's what I was missing! Thank you so much! Things work now, and I
can see how to add whatever the create() function returns to wherever I
want on the page by finding the correct location. Makes sense now....
—
Reply to this email directly, view it on GitHub
<#15 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4XAKBUCO3ZDQK62VH3XUD2CY5LZAVCNFSM6AAAAABSTYHR62VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMZZHE3DEMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@laffra I'm very interested in ltk but as I try it I believe I am missing something fundamental. Specifically, in the examples, each file has a
create()
function. I don't understand howcreate()
is used for a given example.For example, when I look through the code that generates https://pyscript.github.io/ltk/, I see instances of
.create()
in theexamples.__init__.py
file in theitems
list. Whenexamples
is imported, I understand that the code in__init__.py
will be executed and therefore each.create()
function will be called, returning whateverltk
things it creates. But I don't understand how these are populated in the relevant tabs.Alternatively, if I take the code from a specific example file and try to use it in my own simple
index.html
file (with pyscript, ltk, etc. properly loaded in the file), I don't know where I should call thecreate()
function, and things I have tried have resulted in errors. Any clarification you can provide would be much appreciated. Thanks!Beta Was this translation helpful? Give feedback.
All reactions