More Related Content
Python入門からpython twitter利用のハンズオン 今年使ってみて良かった、Pythonモジュール、パッケージ、ツール 「Python言語」はじめの一歩 / First step of Python XML-RPC : Pythonが「電池付属」と呼ばれる理由 「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12 久しぶりのPythonでgoogleのアレを制御してみた What's hot (18)
各OSにおいて、OpenCVをpythonから使う方法 python-twitterを用いたTwitterデータ収集 Python パッケージの影響を歴史から理解してみよう! Pyconjp2014_implementations PySide/QtWebkitで楽々 slideshare Hack Python 2/3コード共存戦略 #osakapy Viewers also liked (20)
Apache Web Server Setup 3 OSCON 2008: Porting to Python 3.0 Securing Apache Web Servers PyTrening 2.0 # 15 Okienka GUI Future Programming Language Apache Web Server Setup 2 10 more-things-you-can-do-with-python An introduction-to-tkinter Introduction to python 3 2nd round Similar to Python twitterとtkinterのことはじめ (20)
20170131 python3 6 PEP526 Cent osにpyhtonをインストールしてみよう 仙台 iOS開発者勉強会 2011/11/03 - TwitterAPIについて RTミドルウエアコンテスト2011応募作品「RTno」 Security.gs fes 2010 in tokyo StreamingAPIを使用したTwitter Bot @waketi の紹介 Wrapping a C++ library with Cython Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ. DATUM STUDIO PyCon2016 Turorial Stellaris を使った組み込みアプリ開発ガイド 広島IT勉強会カレンダー(仮)はRubyを使っています Brief introduction of Boost.ICL Python twitterとtkinterのことはじめ
- 2. お前、誰よ? Name : Yukitaka Uchikoshi job : 結婚式場で社内 SE id: uchikoshi22 level : Python 初心者クラス
- 13. Mac Sudo ports install py27_setuptools Ubuntu sudo apt-get install python-setuptools Fedora sudo yum install python-setuptools
- 19. python-twitterの動作確認 $ python >>> import twitter >>> api = twitter.Api() >>> tl = api.GetUserTimeLine(id=' uchikoshi22 ') >>> for t in tl: print t.text
- 20. PythonのGUIツール Tkinter wxPython Qt 今回はインストール不要のTkinterを使います ※ Tkinter が付属されていない Python が標準で Linux にインストールされていることがあるので、 apt などでインストールする必要が稀にあります。 Titanium Desktop 今回はインストール不要のTkinterを使います(が) ※ Tkinter が付属されていない Python が標準で Linux にインストールされていることがあるので、 apt などでインストールする必要が稀にあります。
- 23. Tkinterでタイムライン表示(2) # 追加するコード def get_timeline(u): api = twitter.Api() tls = api.GetUserTimeline(id=u, count=10) retunrn tls # 自分のアカウントを入力してください。 tls = get_timeline(' uchikoshi22 ') for tl in tls: Label = (root, text=t.text).pack()
- 24. Tkinterでタイムライン表示(3) #!/usr/bin/env python #-*- coding: utf-8 -*- # tk1.pyの全体 from Tkinter import * Import twitter root = Tk() def get_timeline(u): api = twitter.Api() tls = api.GetUserTimeline(id=u, count=10) retunrn tls tls = get_timeline(' uchikoshi22 ') # 自分のアカウントを入力してください for tl in tls: Label = (root, text=t.text).pack() root.mainloop()
- 27. 外部ファイル (tweetauth.py) の利用 #!/usr/bin/env python # -*- coding:utf-8 -*- # tk3.py import tweetauth # tweetauth.py 内の u_id の値を表示 print tweetauth.u_id # tweetauth 内 auth_dict の consumber_key の値を表示 print tweetauth.auth_dict['consumer_key']
- 29. #!/usr/bin/env python #-*- coding: utf-8 -*- from Tkinter import * import twitter import tweetauth user = tweetauth.u_id t_dict = tweetauth.auth_dict def get_friends_timeline(user, max_timeline): api = twitter.Api( consumer_key = t_dict['consumer_key'], consumer_secret = t_dict['consumer_secret'], access_token_key = t_dict['access_token_key'], access_token_secret = t_dict['access_token_secret'], ) friends_timelines = api.GetFriendsTimeline(user, count=) return friends_timelines f_tls = get_friends_timeline(user, max_timeline) for tl in f_tls: tweet = tl.user.screen_name + " => " + tl.text Label(root, text=tweet).pack() root.mainloop()