Skip to content

Instantly share code, notes, and snippets.

@quapka
Last active August 29, 2015 14:07
Show Gist options
  • Save quapka/19e646a9d3ba50e3ef6c to your computer and use it in GitHub Desktop.
Save quapka/19e646a9d3ba50e3ef6c to your computer and use it in GitHub Desktop.
ScreenManager:
FirstScreen:
<FirstScreen>:
FloatLayout:
GridLayout:
cols: 1
canvas.before:
Color:
rgba: 1,0,1,.5
Rectangle:
pos: self.pos
size: self.size
orientation: 'vertical'
BoxLayout:
id: main_label
canvas.before:
Color:
rgba: 0.5,1,0,1
Rectangle:
pos: self.pos
size: self.size
height: root.height / 7
size_hint_y: None
orientation: 'horizontal'
pos: 0, root.height - self.height
Label:
text: 'X. FFDM'
BoxLayout:
id: button_bar
canvas.before:
Color:
rgba: 0,0.5,0.5,1
Rectangle:
pos: self.pos
size: self.size
height: root.height / 7
size_hint_y: None
pos: 0, root.height - (self.height + main_label.height)
orientation: 'horizontal'
Button:
text: 'Films'
size_hint_y: None
height: self.parent.height / 2
Button:
text: 'Harmonogram'
Carousel:
id: my_car
scroll_timeout: 50
pos: 0, root.height - (main_label.height + button_bar.height + self.height)
ScrollView:
id: my_scroll
size_hint_y: None
height: self.parent.height
GridLayout:
id: grid_layout
canvas.before:
Color:
rgba: 0,0.5,0.5,0.6
Rectangle:
pos: self.pos
size: self.size
cols: 1
#size_hint_x: None
size_hint_y: None
width: root.width
height: self.minimum_height
orientation: 'vertical'
Button:
#size_hint_x: None
size_hint_y: None
height: 200.
width: self.parent.width
on_press: root.print_height()
Button:
#size_hint_x: None
size_hint_y: None
height: 200.
width: self.parent.width
Button:
#size_hint_x: None
size_hint_y: None
height: 200.
width: self.parent.width
Button:
#size_hint_x: None
size_hint_y: None
height: 200.
width: self.parent.width
BoxLayout:
Button:
text: 'Friday'
Button:
text: 'Saturday'
Button:
text: 'Sunday'
MyGridLayout:
id: over_lap_grid
x: click_button.x - self.width
cols: 1
canvas:
Color:
rgba: 0, 0, 1, .8
Rectangle:
pos: self.pos
size: self.size
cols: 1
size_hint_x: None
#width: self.minimum_width
width: root.width - root.height / 7
Label:
text:'Settings'
#size_hint_x: None
Label:
text:'label'
#size_hint_x: None
SetButton:
id: click_button
text: 'push'
size_hint: None, None
y: root.height - self.height
height: self.parent.height / 7
width: self.parent.height / 7
on_release: self.click_button_entry()
from kivy.app import App
from kivy.uix.button import Button
from kivy.animation import Animation
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import Screen
from kivy.core.window import Window
class AnimBoxLayoutApp(App):
pass
class FirstScreen(Screen):
def print_height(self, *args):
print self.ids.my_car.height
print self.ids.my_scroll.height
print self.ids.grid_layout.height
print self.ids.grid_layout.minimum_height
pass
class SetButton(Button):
def click_button_entry(self):
if self.x == 0:
a = Animation(x = Window.width - self.width,
#d = 1,
t = 'in_out_cubic')
else:
a = Animation(x = 0,
#d = 1,
t = 'in_out_cubic')
a.start(self)
class MyGridLayout(GridLayout):
def on_touch_down(self, touch):
if self.collide_point(*touch.pos):
# assure ourselves we will get the updates of this motion
touch.grab(self)
return True
AnimBoxLayoutApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment