from kivy.app import App
from kivy.logger import Logger
# from kivy.uix.widget import Widget
from kivy.uix.button import Button
# from kivy.uix.popup import Popup
# from kivy.properties import StringProperty
# from kivy.clock import Clock
from kivy.uix.textinput import TextInput
from kivy.uix.stacklayout import StackLayout
# from kivy.uix.relativelayout import RelativeLayout
# from kivy.uix.listview import ListView
# from twython import Twython
# import netcheck
from twitter.twitter import *


class TweetButton(Button):
    def on_press(self):
        def print_request(success, msg):
            if success:
                Logger.info('Application notified that tweet succeeded')
            else:
                Logger.info('Application notified that tweet failed')

        twitter = PlainTwitter()
        twitter.tweet(app.ttext.text, print_request)


class TweetDirectMsgButton(Button):
    def on_press(self):
        twitter = PlainTwitter()
        twitter.tweetdirectmsg(app.ttext.text)

# class ShowDirectMsgButton(Button):
#     def on_press(self):
#         twitter = PlainTwitter()
#         show_message = twitter.show_message()


class TwitterApp(App):
    def __init__(self, *args, **kwargs):
        global app
        app = self
        super(TwitterApp, self).__init__(*args, **kwargs)

    def on_start(self):
        twitter = PlainTwitter()

    def build(self):
        self.ttext = TextInput(text='tweet',
                               size_hint=(0.3, 0.1),
                               font_size=18)
        tb = TweetButton(text='Tweet Text',
                         size_hint=(0.3, 0.1))
        tib = TweetDirectMsgButton(text='Tweet Direct Message',
                                   size_hint=(0.3, 0.1))

        # tsb = ShowDirectMsgButton(text='Show Direct Message',
        #          size_hint=(0.4, 0.1))

        root = StackLayout()
        root.add_widget(self.ttext)
        root.add_widget(tb)
        root.add_widget(tib)
        # root.add_widget(tsb)
        return root


if __name__ == '__main__':
    TwitterApp().run()

@@ -53,418 +53,128 @@
 ger%0A
-# from kivy.uix.widget import Widget%0Afrom kivy.uix.button import Button%0A# from kivy.uix.popup import Popup%0A# from kivy.properties import StringProperty%0A# from kivy.clock import Clock%0Afrom kivy.uix.textinput import TextInput%0Afrom kivy.uix.stacklayout import StackLayout%0A# from kivy.uix.relativelayout import RelativeLayout%0A# from kivy.uix.listview import ListView%0A# from twython import Twython%0A# import netcheck
+from kivy.uix.button import Button%0Afrom kivy.uix.textinput import TextInput%0Afrom kivy.uix.stacklayout import StackLayout
 %0Afro
@@ -713,156 +713,8 @@
 t)%0A%0A
-# class ShowDirectMsgButton(Button):%0A#     def on_press(self):%0A#         twitter = PlainTwitter()%0A#         show_message = twitter.show_message()%0A%0A%0A
 clas
@@ -1308,115 +1308,8 @@
 1))%0A
-%0A        # tsb = ShowDirectMsgButton(text='Show Direct Message',%0A        #          size_hint=(0.4, 0.1))%0A%0A
     
@@ -1430,39 +1430,8 @@
 ib)%0A
-        # root.add_widget(tsb)%0A
     

remove unused code