Beispiel #1
0
 def list_notebooks(self):
     notes = self.get_notebooks()
     with self.canvas:
         layout = GridLayout(rows = len(notes))
         layout.size = self.size
         for note in notes:
             bot = Button(text=note,pos_hint_x = .7, width=100)
             bot.bind(on_press=self.lame)
             layout.add_widget(bot)
Beispiel #2
0
 def _make_modalview(self, *args):
     if not self.modalview:
         self.modalview = ModalView()
     if self.modalview.children:
         container = self.modalview.children[0]
     else:
         container = GridLayout(cols=self.cols)
         self.modalview.add_widget(container)
     container.size = container.minimum_size
     self._update_modalview()
Beispiel #3
0
 def _update_modalview(self, *args):
     if not self.modalview:
         Clock.schedule_once(self.on_options, 0)
         return
     if not self.modalview.children:
         container = GridLayout(cols=self.cols)
         self.modalview.add_widget(container)
     else:
         container = self.modalview.children[0]
     for option in self.options:
         if type(option) is tuple:
             text, value = option
             container.add_widget(Button(
                 size_hint_y=None, height=30,
                 text=text, on_release=partial(self._set_value_and_close, text)))
         else:
             container.add_widget(Button(
                 text=str(option), on_release=partial(
                 self._set_value_and_close, str(option)),
                 size_hint_y=None, height=30))
     container.size = container.minimum_size
Beispiel #4
0
    def __init__(self, comicBook, **kwargs):
        super(KivyThumnailsPages, self).__init__(**kwargs)

        self.listaThumnails=[]
        lista = GridLayout(cols=comicBook.getCantidadPaginas())
        lista.size_hint_x = None
        print(comicBook.getCantidadPaginas())
        lista.size=(120*comicBook.getCantidadPaginas(),0)
        for n in range(1, comicBook.getCantidadPaginas()):
            # pagina = comicBook.getImagePage()
            pagina = comicBook.getThumnail()
            comicBook.gotoNextPage()
            panel = KivyThumnail(pagina,n,self)
            lista.add_widget(panel, index=0)
            self.listaThumnails.append(panel)
        self.sb = scroll = ScrollView()
        scroll.size_hint_y = None
        scroll.size[1] = 150
        scroll.add_widget(lista)
        # scroll.bind(on_touch_down=self.callback)
        self.add_widget(scroll)
        scroll.bind(on_scroll_stop=self.scrollStop)
Beispiel #5
0
    def build(self):
        self.first = [12, 10]
        self.second = [13, 10]
        self.sm = ScreenManager()
        screen = Screen(name="select_character")
        self.helth_1 = 5
        self.helth_2 = 5
        self.helth_1_label = Label(text="1 health: " + str(self.helth_1),
                                   pos=(0, 0),
                                   size=(200, 100))
        self.helth_2_label = Label(text="2 health: " + str(self.helth_2),
                                   pos=(1300, 0),
                                   size=(200, 100))
        self.hod = 0
        self.oh = 0
        self.prep = [[13, 12], [13, 13], [13, 14], [2, 7], [11, 20], [13, 5],
                     [14, 16], [10, 16], [12, 7], [9, 8], [11, 5], [8, 7],
                     [12, 12], [7, 6], [7, 7], [7, 8], [8, 9], [9, 8], [4, 7],
                     [14, 6], [12, 14], [6, 9], [12, 14], [14, 15], [14, 29],
                     [10, 30]]
        self.title = ""
        f = Widget()
        self.i = 0
        button = GridLayout(cols=30)
        button.size = (1500, 750)
        self.button = [0 for _ in range(450)]
        self.a = list()
        for y in range(15):
            self.a.append(list())
            for x in range(30):
                if ([y, x] in self.prep):
                    self.a[y].append(str(y * 30 + x) + "g")
                else:
                    self.a[y].append(str(y * 30 + x))
        self.mas = list()
        for i in range(450):
            t = True
            for j in self.prep:
                if (int(i / 30) == j[0] and int(i % 30) == j[1]):
                    print(1)
                    self.mas.append(
                        Button(text='',
                               on_press=self.callback_press,
                               id=str(i),
                               background_color=[0.0, 2.0, 0, 1.0]))
                    t = False
                    break
            if (t):
                self.mas.append(
                    Button(text='',
                           on_press=self.callback_press,
                           id=str(i),
                           background_color=[1.0, 0.0, 0, 1.0]))
            button.add_widget(self.mas[i])
        self.a[12][10] = "370r"
        self.a[13][10] = "400b"
        self.img = Image(source='1.jpg')
        self.img.size = (50, 50)
        self.img.pos = (10 * 50, 2 * 50)
        self.img2 = Image(source='2.jpg')
        self.img2.size = (50, 50)
        self.img2.pos = (10 * 50, 1 * 50)
        self.img_win_1 = Image(source='3.png')
        self.img_win_1.size = (1200, 600)

        self.img_win_1.pos = (1212, 1313)
        self.img_win_2 = Image(source='4.png')
        self.img_win_2.size = (1200, 600)
        self.img_win_2.pos = (1212, 1313)
        f.add_widget(button)
        f.add_widget(self.img)
        f.add_widget(self.img2)
        f.add_widget(self.img_win_1)
        f.add_widget(self.img_win_2)
        f.add_widget(self.helth_1_label)
        f.add_widget(self.helth_2_label)
        f.add_widget(screen)
        return f