Submit Search
Upload
Python講座 2018 第4回
•
0 likes
•
62 views
Y
Yuuki Ohta
Follow
K3にて実施するPython講座の資料。 今回はグラフィックに関してです
Read less
Read more
Technology
Report
Report
1 of 23
Recommended
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
Recommended
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
Introduction to C Programming Language
Introduction to C Programming Language
Simplilearn
More Related Content
Featured
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
Introduction to C Programming Language
Introduction to C Programming Language
Simplilearn
Featured
(20)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
ChatGPT webinar slides
ChatGPT webinar slides
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Introduction to C Programming Language
Introduction to C Programming Language
Python講座 2018 第4回
1.
Python講座第4回 参考資料
2.
前回の復習
3.
反復構造(While) While 条件式 or
真偽値: [中身(実行するプログラム)] • 条件式 or 真偽値がTrue(真)である限り[中身]を繰り返す • 条件式 or 真偽値がFalse(偽)になったときは[中身]を実行しない もしくは実行していた場合は抜ける
4.
関数(def) def [関数名(自由)](引数,引数,…): [中身(実行するプログラム)] return [返す値]
#返す値があるときのみ 繰り返し使う動作を一つにまとめられる • 記述量を減らせる • ミス(バグ)があった際に直す箇所が集約されているの で直しやすい
5.
グラフィックス
6.
グラフィカルユーザーインターフェース(GUI) ユーザーに視覚的に分かりやすい(グラフィカルな)UIを提供する CUI GUI
7.
標準で入っているGUIライブラリ • turtle • Tkinter(Tk)
8.
turtle
9.
turtle ペンでお絵描きすることができる! 使える関数 動作 t.penup() ペン先をキャンバス から離す t.pendown()
ペン先をキャンバス に置く t.setpos(x, y) 任意の座標まで移動 する t.pencolor('red') 線の色を変更する t.pensize(3) 線の太さを変更する t.write('hello!') 現在位置のすぐ上に 文字列を描画 使える関数 動作 t.forward(10) 現在の向きに10距離前進 する t.left(10) 10度左に向きを変える t.right(10) 10度右に向きを変える t.circle(50,240) 回転半径50で270度の円 弧を描くように進む
10.
turtle import turtle t =
turtle.Turtle() t.color("blue") t.pendown() # ペンを下す t.forward(100) # 100進む t.penup() # ペンを上げる t.setpos(10, 10) # ペン先を (10,10)に移動 t.pendown() # ペンを下す t.setpos(50, 50) # ペン先を (50,50)に移動 t.left(90) # 90度左回転 t.forward(100) # 100進む t.shape("turtle") # 形を亀に変更 t.right(180) # 右に180度回転 t.forward(100) # 100進む turtle._Screen.mainloop(turtle) turtle.exitonclick() turtleを使えるよ うにするおまじない IDLE以外では記述 しとかないと表示を 維持できない
11.
座標について
12.
正三角形を描こう!
13.
角度について
14.
正五角形を描こう!
15.
Tkinter(Tk)
16.
Tkinter 手軽にGUIアプリケーションが作れる! ButtonやLabel,Canvas,Frameなど多くの機能を備える from tkinter import
* tk = Tk() Tkinterを使うためのおまじない笑
17.
ウィンドウの表示 from tkinter import
* tk=Tk() canvas=Canvas(tk, width=500, height=500) #500×500のウィンドウを作成 canvas.pack() canvas2 = Canvas(tk2) # ウィンドウサイズ指定なし canvas2.pack() pack()しないとウィンドウ上に何も表示されない
18.
ウィンドウの表示
19.
Tkinter 表示維持に必要!(IDLE以外) mainloop()
20.
座標について
21.
正三角形を描こう!
22.
家を描こう!
23.
グラフを描こう!
Editor's Notes
CUIはキャラクターユーザーインターフェース GUIはグラフィカルユーザーインターフェース
もし,IDLE以外を使用している場合は実行終了とともにウィンドウが閉じてしまう。 その場合は,turtle._Screen.mainloop(turtle)かturtle.exitonclick()をプログラムの最後に追記しておきましょう
矢印の先が向いている向き。そこを基準として角度が決まります。
いっぱい機能はあるけど,法政大学ではCanvasくらいしか使わないので,Canvasのみ扱います。
初期値があるので,width=などは記載せずともウィンドウは生成される。
いっぱい機能はあるけど,法政大学ではCanvasくらいしか使わないので,Canvasのみ扱います。