Cov txheej txheem:
- Kauj ruam 1: Yuav tsum tau ua
- Kauj ruam 2: Siv IDLE Editor
- Kauj Ruam 3: Thawj Kab Ntawm Txoj Cai - Ntshuam nab nab
- Kauj Ruam 4: Tsim Square
Video: Kawm paub Code Siv Python Turtle: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Hauv qhov kev qhia no peb yuav qhia rau lub ntiaj teb kev lom zem ntawm kev siv Python, tshwj xeeb yog Tsev Qhua Turtle.
Peb xav tias koj tsis muaj kev paub ua ntej coding. Yog tias koj xav paub ntau ntxiv, peb xav kom nyeem tus kws sau phau ntawv:
www.amazon.com/by-Omar-Silva-Zapata/e/B00Y…
Kauj ruam 1: Yuav tsum tau ua
Yuav tsum muaj dab tsi?
Ib lub PC lossis Raspberry Pi nrog Python 2.7 lossis ntau dua tau teeb tsa.
Zoo kawg Python tuaj yeem ua haujlwm hauv txhua lub PC hauv feem ntau ntawm kev ua haujlwm. Yog xav paub yuav ua li cas rub tus nab npawb hauv koj lub cuab yeej mus rau:
www.python.org/
Hauv qab rub tawm cov ntawv qhia zaub mov, xaiv koj lub operating system thiab ua raws cov lus qhia teeb tsa.
Kauj ruam 2: Siv IDLE Editor
Python's IDLE (Kev Txhim Kho Kev Txhim Kho thiab Kawm Ib puag ncig) yog tus kho peb yuav siv hauv qhov kev qhia no tab sis muaj ntau ntxiv. Ntawm Robo-Geek peb nyiam qhov ntawd yooj yim to taub, nws tau ua txoj haujlwm tiav thiab nws tsis hem thawj tus thawj coders. Yog xav paub ntau ntxiv txog IDLE, thov txheeb xyuas:
docs.python.org/2/library/idle.html
Tom qab Python teeb tsa, peb yuav tsum qhib IDLE.
Yuav ua li cas qhib IDLE editor yuav nyob ntawm seb lub operating system twg tau siv. Rau qhov yooj yim qhov seem ntawm kev qhia yuav xav tias koj siv lub PC nrog Windows 10. Yog tias tsis yog, tsis txhob txhawj ntau dhau, tshawb nrhiav internet sai thiab koj yuav pom ntau cov kev pab.
Hauv Windows, tsuas yog mus rau Start Menu, saib Python nplaub tshev thiab xaiv IDLE icon.
Yog ua tiav koj yuav pom lub vijtsam uas qhia hauv daim duab rau theem no. Thawj kab hauv qab cov ntawv qhia zaub mov, hais tias Python version koj tab tom siv.
Kauj Ruam 3: Thawj Kab Ntawm Txoj Cai - Ntshuam nab nab
Tam sim no yog qhov txaus siab ntawm qhov qhia. Cia peb mus rau code:
Ua ntej peb yuav tsum hu rau lub tsev qiv ntawv peb yuav siv, qhov no yog ua tiav siv cov lus txib ntshuam. Ntaus cov hauv qab no thiab nias Enter.
ntshuam vaub kib
Daim ntawv ceeb toom IDLE yuav hais txog txiv kab ntxwv nab nab hais kom ua ntshuam. Tom ntej no peb yuav tsum tsim cov khoom vaub kib, ntaus cov cai hauv qab no thiab nias Enter
t = vaub kib. Turtle ()
Thaum koj ua tiav nias Enter, yog tias tsis muaj cov kab lus sau lossis sau tsis raug, lub vijtsam tshiab uas qhia txog daim duab peb sab hauv nruab nrab ntawm cov keeb kwm yav dhau dawb yuav pom zoo li hauv daim duab rau qib no. Muab lub qhov rais cais thiab kho qhov rai qhov ntev kom lawv haum ib sab.
Kauj Ruam 4: Tsim Square
Daim duab peb sab me me nyob hauv nruab nrab ntawm lub vijtsam sawv cev rau tus vaub kib.
Txhawm rau kom tus vaub kib txav mus rau tom ntej, ntaus cov hauv qab no:
twb.fd (100)
Daim ntawv ceeb toom, tus vaub kib tau txav mus 100 pixels hauv qhov kev taw qhia tus vaub kib tau taw tes. Tam sim no cia peb tig lub vaub kib 90 degrees kom taw tes:
tsi (90)
Tam sim no tus vaub kib poob qis, peb yuav sau ob peb lo lus txib ntxiv kom ua tiav lub xwmfab:
t.fd (100) t.rt (90) t.fd (100) t.rt (90) t.fd (100)
Zoo heev koj tau ua tiav koj thawj lub xwmfab!
Tam sim no cia pib dua, nqa tus vaub kib tsev thiab tshem qhov screen los ntawm:
t.home ()
t.clear ()
Xwb, peb tuaj yeem kos cov xwm txheej kom zoo dua qub los ntawm kev siv lub voj:
rau kuv hauv thaj tsam (4):
t.fd (100) t.rt (90)
Peb tuaj yeem hloov xim ntawm tus vaub kib mus rau xiav los ntawm:
t.color ('xiav')
Thiab tau kawg peb tuaj yeem ua ntau yam ntxiv, qhov kev qhia no tsuas yog ua rau koj saj thiab ua rau koj mus. Yog xav paub ntxiv tshawb xyuas Python Turtle cov ntaub ntawv, docs.python.org/2/library/turtle.html
Kuj xav txog kev yuav tus sau phau ntawv:
www.amazon.com/by-Omar-Silva-Zapata/e/B00Y…
Zoo tshaj plaws.
Pom zoo:
Lub Hnub Qub Paub Paub Siv Lub Zeem Muag Computer (OpenCV): 11 Kauj Ruam (nrog Duab)
Star Recognition Siv Computer tsis pom kev (OpenCV): Qhov no instructable yuav piav txog rau koj yuav ua li cas rau tsim ib tug computer tsis pom kev pab cuam yuav tau qhia hais tias lub hnub qub qauv nyob rau hauv ib tug duab. Txoj hauv kev siv OpenCV (Qhib-Qhov Khoos Phis Tawj Lub Zeem Muag Lub Zeem Muag) lub tsev qiv ntawv los tsim cov txheej txheem ntawm HAAR cascades uas tuaj yeem
2 Tsab Ntawv Kawm Tus Neeg Kawm Nrog Morse Code: 5 Kauj Ruam
2 Tus Neeg Kawm Ntawv Cov Lus Nrog Morse Code: Kuv tau sim kawm Scrabble (tm) 2 tsab ntawv ib pliag nrog qhov tsis ua tiav. Kuv kuj tseem tau sim kawm paub Morse code dua nrog kev ua tiav me me.Kuv txiav txim siab sim qee qhov kev kawm subliminal los ntawm kev tsim ib lub thawv uas qhia txuas ntxiv
SCARA Robot: Kawm Txog Foward thiab Rov Qab Kinematics !!! (Plot Twist Kawm Yuav Ua Li Cas Ua Lub Sij Hawm Tiag Hauv ARDUINO Siv Kev Ua Haujlwm !!!!): 5 Cov Kauj Ruam (nrog Duab)
SCARA Robot: Kawm Txog Foward thiab Rov Qab Kinematics !!! (Plot Twist Kawm Yuav Ua Li Cas Ua Lub Sij Hawm Tiag Hauv ARDUINO Siv Kev Ua Haujlwm !!!!): SCARA neeg hlau yog lub tshuab nrov heev hauv ntiaj teb kev lag luam. Lub npe sawv cev rau ob qho Kev Xaiv Ua Raws Li Lub Rooj Sib Tham Robot Arm lossis Xaiv Ua Raws Li Cov Neeg Siv Khoom Ua Haujlwm. Nws yog qhov tseem ceeb ntawm peb qib ntawm kev ywj pheej neeg hlau, yog thawj ob lub tebchaws
Yuav Ua Li Cas Tsim Cov Tsev Kawm Qib Siab-Siv Nyiaj Siv Excel: 12 Cov Kauj Ruam
Yuav Ua Li Cas Tsim Cov Tsev Kawm Qib Siab-Siv Pob Nyiaj Siv Excel: Microsoft Excel yog cov cuab yeej muaj zog heev uas tau siv hauv kev lag luam hauv ntiaj teb niaj hnub. Feem ntau nws tau siv los sib txuas lus li cas kev lag luam tau ua tiav nyiaj txiag, tab sis nws ’ kev siv yog qhov kawg. Txawm hais tias koj siv Excel los tsim qhov nyuaj Pro
Taw qhia rau Robotics rau Cov Tub Kawm Ntawv Hauv Tsev Kawm Ntawv Nrog Hummingbird Controllers: 18 Cov Kauj Ruam
Taw qhia rau Robotics rau Cov Tub Ntxhais Kawm Hauv Tsev Kawm Ntawv Nrog Hummingbird Controllers: Feem ntau cov cuab yeej neeg hlau ntawm kev ua lag luam niaj hnub no xav kom tus neeg siv rub tawm cov software tshwj xeeb rau hauv lawv lub hard drive. Qhov zoo nkauj ntawm Hummingbird Robotic Controller yog qhov nws tuaj yeem ua haujlwm siv lub vev xaib hauv computer, xws li chromebook. Nws tseem yog