Build a PyScript guestbook webapp | PyScript Tutorial #4

  Рет қаралды 4,533

Samuel Chan

Samuel Chan

Күн бұрын

Пікірлер: 12
@SamuelChan
@SamuelChan 2 жыл бұрын
Here's part 1: kzbin.info/www/bejne/h6CblYuvgL2sg6c : Focus on importing PyScript, its syntax and key usage patterns. A get started guide for anyone new to pyscript. Here's part 2: kzbin.info/www/bejne/pXnCo4eKec-ArK8. This takes a full PyScript and deploy it onto GitHub Pages (using GitHub Action) for free! We'll use a lot of the same knowledge here but get to see an end-to-end deployment too! Part 3 kzbin.info/www/bejne/q5i2c5SFiZWljKs will see us build a fully interactive analytics dashboard with Altair and PyScript. Part 4 (this video!) we'll build a CRUD (create read update delete) system in the form of a guest book using PyScript. This is something you'd do with Vue or React in the past, but now it's only a few lines of Python code. Subscribe to the channel and leave other future ideas here!
@brucewernick6542
@brucewernick6542 2 жыл бұрын
I see examples showing complicated stuff like using numpy and matplotlib. But, how do you get the value from a simple html input?
@SamuelChan
@SamuelChan 2 жыл бұрын
In this video, we set up the input at 11:40 with: Then we get the value by referencing the new_entry.value. You saw me do the new_entry.value.split(','). Are there ways to get value from html input without using py-inputbox? Yes. That requires you to selectElementByID() in javascript (I covered that in part 2 of the series too). The method I use in part 4 (this video) is probably easier though.
@brucewernick6542
@brucewernick6542 2 жыл бұрын
Thanks. I can see res in the console but how do you write it below the inout? def on_keypress(e): if (e.code == "Enter"): res = Element("newval") console.log(res.value)
@SamuelChan
@SamuelChan 2 жыл бұрын
To use things like console or document, you will have to do; from js import console, document console.log(res.value) Since they’re something that js has access to. I’ll touch on that in the next video :)
@brucewernick6542
@brucewernick6542 2 жыл бұрын
OK, I have managed to make a simple demo. PyScript from js import document result = "the answer is 42!" pyscript.write("result", result)
@PtolemySoter
@PtolemySoter 2 жыл бұрын
Is there a way to read HTML Form posted values with py-script?
@SamuelChan
@SamuelChan 2 жыл бұрын
Yes it’s something we do in Part 2 my bro; We use the HTML form in that tutorial :) kzbin.info/www/bejne/pXnCo4eKec-ArK8
@editssinfinity5355
@editssinfinity5355 2 жыл бұрын
Hey, Can anyone tell me how to render another html page using pyscript?
@virencablenet9546
@virencablenet9546 2 жыл бұрын
Hi Bro Your html page should contain Choose file and submit button And on submit button read Uploaded file and print that data on web
@SamuelChan
@SamuelChan 2 жыл бұрын
Thanks for the idea my bro. I wanted to stick to the CRUD pattern more in part 4 - I can create a part 5 in this series to explore the file submission pattern when I’ve got time? 😀 thanks for the suggestion though! 🙏🏼
@virencablenet9546
@virencablenet9546 2 жыл бұрын
@@SamuelChan ya please this above approach is more important. All the stuff you show is easily available. But approach i ask no one as made so far any video on it. Mostly probably if you could get me by tomorrow will be great helpful
PyScript Demo / Tutorial | End-to-end PyScript Tutorial #1
28:01
Samuel Chan
Рет қаралды 38 М.
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 3,8 МЛН
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
BeatboxJCOP
Рет қаралды 66 МЛН
HELP!!!
00:46
Natan por Aí
Рет қаралды 67 МЛН
Avoid These BAD Practices in Python OOP
24:42
ArjanCodes
Рет қаралды 72 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 77 М.
PyScript is officially here!🚀 Build web apps with Python & HTML
17:10
Don't Use Websockets (Until You Try This…)
6:46
Code With Ryan
Рет қаралды 320 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 250 М.