I'm making a scraper/web crawler using Kivy when I run the code it works but I'm not sure if what I'm doing is Pythonic because all the language I can find is about using the Kivy library. I'm unsure about putting the functions to bind the widgets to inside the build method. Is there a better way?

class MainApp(App):

    def build(self):
        root = RootWidget()
        c = CustomLayout()

        search_term = TextInput(
            size_hint=(.5, .05),
            pos=(250, 15))

        def on_enter(self):
            scrape = Scrape(search_term.text, ['user_agent','chrome'])
        get_links = Button(
            text='Get links',
            size_hint=(.5, .10),
            pos=(20, 20))

        return root
  • \$\begingroup\$ You know Google has bot protection against this kind of thing, right? \$\endgroup\$ – Quill Feb 2 '16 at 22:33
  • \$\begingroup\$ @Quill It still works though ;). \$\endgroup\$ – Eric MacLeod Feb 2 '16 at 22:36
  • \$\begingroup\$ Not saying it doesn't, just might not be effective when you ramp up the speeds. \$\endgroup\$ – Quill Feb 2 '16 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.