Here is the code i'm using:
from Tkinter import *
import tweepy
from secrets import *
auth = tweepy.OAuthHandler(C_KEY, C_SECRET)
auth.set_access_token(A_TOKEN, A_TOKEN_SECRET)
api = tweepy.API(auth)
class MyFirstGUI(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
self.instructions = Label(self, text="Enter your tweet")
self.instructions.grid(row = 0, column = 0, columnspan = 2, sticky = W)
self.tweet = Entry(self)
self.tweet.grid(row=1, column = 0, sticky = W)
self.submit_button = Button(self, text="Tweet", command = self.post)
self.submit_button.grid(row = 2, column = 0, sticky=W)
def post(self):
content = self.post
api.update_status(content)
root = Tk()
my_gui = MyFirstGUI(root)
root.mainloop()
Whenever I try tweeting, it will post something like <bound method http://MyFirstGUI.post of <__main__.MyFirstGUI instance at 0x0000000003BFF688>>
instead of what I had put in the textbox. Any idea what the heck is going on?
Aucun commentaire:
Enregistrer un commentaire