Python3とtkinterとTwitterAPIを使ってTwitterAPIを作っています。
プログラムの大体の骨組みは作りましたが、肝心なツイートを送信する方法が調べてもわかりませんでした。書く場所は多分あっていると思うのですが...
↓プログラム
Pyhon3
1# -*- coding: utf-8 -*- 2import sys 3import tkinter 4import json, config 5from urllib import request 6 7 8from requests_oauthlib import OAuth1Session 9 10 11CK = config.CONSUMER_KEY 12CS = config.CONSUMER_SECRET 13AT = config.ACCESS_TOKEN 14ATS = config.ACCESS_TOKEN_SECRET 15twitter = OAuth1Session(CK, CS, AT, ATS) 16 17 18root = tkinter.Tk() 19root.title(u"ツイート") 20root.geometry("400x300") 21 22#ツイートする文章を入力する欄をつくり、位置を決める 23tb = tkinter.Text(width=34,height=5) 24tb.place(x=75, y=90) 25 26def push(event): #送信ボタンが押された時の命令を定義する 27 28 #ここに書く処理がわかりません 29 30 31#ボタンの位置とテキストを決める 32b = tkinter.Button(text=u'ツイート', width=16) 33b.bind("<Button-1>",push) 34b.place(x=130, y=170) 35 36 37root.mainloop() 38 39 40 41
あなたの回答
tips
プレビュー