def __init__(self, **kwargs): super().__init__(**kwargs) self.orientation = 'vertical' self.add_widget(nav()) Box1 = BoxLayout(orientation='vertical', padding=[10, -125, 10, 35]) Box1.add_widget( Label(text="HealthCare (For Doctors)", font_size='30sp')) Box2 = BoxLayout(padding=[50, -175, 50, 35]) carousel = Carousel(direction='right') for i in range(1, 5): src = "res/%s.jpg" % str(i) image = AsyncImage(source=src, allow_stretch=False) carousel.add_widget(image) carousel.loop = True Clock.schedule_interval(carousel.load_next, 2) Box2.add_widget(carousel) Grid2 = GridLayout(cols=2, size_hint=(1.0, 0.1), padding=[50, -20, 50, 20], spacing=20, row_default_height=30, row_force_default=True) Login = Button(text='Login', on_press=self.Login_Callback) Signup = Button(text='SignUp', on_press=self.Signup_Callback) Grid2.add_widget(Login) Grid2.add_widget(Signup) self.add_widget(Box1) self.add_widget(Box2) self.add_widget(Grid2)
def build(self): # define the carousel carousel = Carousel(direction="right") carousel.anim_move_duration = 1 carousel.padding = 40 carousel.loop = True image1 = Image(source="nature1.jpg") carousel.add_widget(image1) image2 = Image(source="nature2.jpg") carousel.add_widget(image2) image3 = Image(source="nature3.jpg") carousel.add_widget(image3) image4 = Image(source="nature4.jpg") carousel.add_widget(image4) eticheta = Label(text="Am ajuns la finalul listei!", font_size=40) carousel.add_widget(eticheta) return carousel
def build(self): #define the carousel carousel = Carousel(direction='right') carousel.anim_move_duration = 1 carousel.padding = 40 carousel.loop = True image1 = Image(source="nature1.jpg") carousel.add_widget(image1) image2 = Image(source="nature2.jpg") carousel.add_widget(image2) image3 = Image(source="nature3.jpg") carousel.add_widget(image3) image4 = Image(source="nature4.jpg") carousel.add_widget(image4) eticheta = Label (text = "Am ajuns la finalul listei!", font_size = 40) carousel.add_widget(eticheta) return carousel
def __init__(self, **kwargs): # make sure we aren't overriding any important functionality super(Widgets, self).__init__(**kwargs) Config.set('graphics', 'width', '1800') Config.set('graphics', 'height', '900') Config.write() root = Widget() print "root.width: %f" % root.width print "root.height: %f" % root.height self.add_widget( AsyncImage(source=str(Global.image_url), pos=(-root.width * 6, root.height * 3.25))) self.add_widget( Label(text='@' + str(Global.screen_name), pos=(-root.width * 6, root.height * 2))) self.add_widget( Label(text="location: " + str(Global.location), pos=(-root.width * 6, root.height * 1.3))) self.add_widget( Label(text="verified: " + str(Global.verified), pos=(-root.width * 6, root.height))) self.add_widget( Label(text="on Twitter since: " + str(Global.created_at), pos=(-root.width * 6, root.height * 0.7))) self.add_widget( Label(text="description:\n" + str(Global.description), pos=(-root.width * 6, root.height * 0.3))) self.add_widget( Label(text=str(Global.tweets) + "\ntweets", pos=(-root.width * 3, root.height * 3.5))) self.add_widget( Label(text=str(Global.followers) + "\nfollowers", pos=(-root.width, root.height * 3.5))) self.add_widget( Label(text=str(Global.following) + "\nfollowing", pos=(root.width, root.height * 3.5))) self.add_widget( Label(text=str(Global.average_tweet_time) + "\naverage tweet time", pos=(root.width * 5, root.height * 4))) self.add_widget( Label(text=str(Global.average_tweet_retweets) + "\naverage retweets in tweets", pos=(root.width * 5, root.height * 3))) self.add_widget( Label(text=str(Global.average_tweet_favorites) + "\naverage favorites in tweets", pos=(root.width * 5, root.height * 2))) self.add_widget( Label(text=str(Global.followback_percentage), pos=(-root.width * .4, root.height * 1.5))) self.add_widget( Image(source=str(Global.wordcloud_tweets_image), pos=(root.width * 0.35, root.height), size_hint_y=None, height=350)) if (Global.hashtags_found > 0): self.add_widget( Image(source=str(Global.wordcloud_hashtags_image), pos=(-root.width * 6, root.height), size_hint_y=None, height=350)) self.add_widget( Label(text="most tweets per day: " + str(Global.most_tweets_per_day) + " on " + str(Global.most_tweets_day), pos=(-root.width * .6, root.height * 0.6))) self.add_widget( Label(text="5 most recent tweets: ", pos=(-root.width * .6, -root.height * 3.5))) carousel = Carousel(direction='right') for i in range(5): tweet_layout = FloatLayout() tweet_layout.add_widget( Label(text="#" + str(i + 1) + ":\n" + Global.five_latest_tweets[i], pos=(-root.width * .6, -root.height * 3.8))) tweet_layout.add_widget( Image(source=str('img/date.png'), pos=(-root.width * 1.8, 0), size_hint_y=None, height=35)) tweet_layout.add_widget( Image(source=str('img/retweets.png'), pos=(-root.width * 0.5, 0), size_hint_y=None, height=35)) tweet_layout.add_widget( Image(source=str('img/likes.png'), pos=(root.width * 0.2, 0), size_hint_y=None, height=35)) tweet_layout.add_widget( Label(text=Global.five_latest_dates[i], pos=(-root.width * 1.2, -root.height * 4.32))) tweet_layout.add_widget( Label(text=Global.five_latest_retweets[i], pos=(-root.width * 0.2, -root.height * 4.32))) tweet_layout.add_widget( Label(text=Global.five_latest_likes[i], pos=(root.width * 0.5, -root.height * 4.32))) carousel.add_widget(tweet_layout) carousel.disabled = True carousel.opacity = 6 carousel.loop = True self.add_widget(carousel) timeline.create() self.add_widget( Image(source='png/' + str(Global.screen_name) + '_gantt.png', pos=(root.width * 6.35, root.height * 1.5), size_hint_y=None, height=380)) if (Global.fishy_followers != 0): self.add_widget( Image(source='img/warning.png', pos=(-root.width * 2, root.height * 6.5), size_hint_y=None, height=35)) self.add_widget( Label(text=str(Global.fishy_followers) + " suspicious followers found", pos=(-root.width * 0.8, root.height * 2.15))) def printit(): if (self.run_carousel): threading.Timer(5.0, printit).start() # print "RUNNING THREAD!" carousel.load_next(mode='next') printit()
class kivy05(App): def build(self): return root # create Carousel root = Carousel(direction='right') lb1 = Label(text='Slide_1') lb2 = Label(text='Slide_2') lb3 = Label(text='Slide_3') root.add_widget(lb1) root.add_widget(lb2) root.add_widget(lb3) root.loop = True # Auto swipe # callback function def auto_swipe(dt): print(dt) root.load_next() return True # schedule tm = Clock.schedule_interval(auto_swipe, 3) print(type(tm))