def __activate_no_connection_screen(self): """ Warning screen about - No connection Available :return: """ # Menu Background self.bckg_image = get_background(picture_path='pictures/menu_background.png') self.add_widget(self.bckg_image) # No connection label text no_connection_l = Label(text='[b]No Internet connection available ![/b]', markup=True) no_connection_l.font_size = FONT_SIZE_HEADLINES no_connection_l.bold = True no_connection_l.color = [0.8, 0.8, 0.8, 0.5] no_connection_l.pos_hint = {'x': .0, 'y': .3} self.add_widget(no_connection_l) # No connection label description no_connection_l = Label(text='Please check or activate your data connection.') no_connection_l.font_size = 47 no_connection_l.bold = True no_connection_l.color = [0.8, 0.8, 0.8, 0.5] no_connection_l.pos_hint = {'x': .0, 'y': .0} self.add_widget(no_connection_l) # Main menu button self.main_menu_b = Button(text='Main menu', font_size=FONT_SIZE_BUTTON, size_hint=SIZE_HINT_BUTTON_LEVELS, pos_hint={'x': .4, 'y': .2}) self.main_menu_b.bind(on_press=self.__activate_menu) self.add_widget(self.main_menu_b)
def __init__(self, **kwargs): super().__init__(**kwargs) self.orientation = 'vertical' # simple label label1 = Label() label1.text = 'Hello Florian, \nWhat\'s up ?' label1.font_size = 42 label1.bold = True label1.underline = True label1.halign = 'center' label1.color = (0, 1, 0, 1) self.add_widget(label1) # markup text label2 = Label() label2.text = '[size=30]I try to [u]code[/u] a [b]kivy app[/b] ![/size]' label2.halign = 'center' label2.markup = True label2.color = (0, 0, 1, 1) self.add_widget(label2) # unicode text label3 = Label() label3.text = 'هل يمكن تأجير عربات للأطفال؟' label3.font_name = 'DejaVuSans' self.add_widget(label3) # Icons text label4 = Label() label4.font_size = 60 label4.text = '\uF00A' label4.font_name = 'Icons' self.add_widget(label4)
def constroi_linha(self, lista): nome, *args = lista n = 1 spacing = "10sp" padding = [f"{i}sp" for i in [0, 0, 10, 0]] grid = GridLayout(cols=1, size_hint_y=None) grid.bind(minimum_height=grid.setter("height")) label = Label(text=nome) label.size_hint_y = None label.height = self.height * .1 label.font_size = self.fonte_padrao * n label.valign = "center" label.halign = "center" label.text_size = [self.width * .9, self.height * .9] grid.add_widget(label) #grid.ids["descricao"] = label for valor in args: label = Label(text=valor) label.size_hint_y = .1 label.halign = label.valign = "center" label.text = valor label.height = self.height * .1 label.font_size = self.fonte_padrao * .9 label.text_size = [self.width * .9, self.height * .9] grid.add_widget(label) #grid.ids["valor"] = label #self.ids[f"{self.nome_tela}_campo_{self.n}"] = grid return grid
def update_tuner(self, note_name, cents): tuner_page = self.screens[5].layout tuner_page.clear_widgets() guide = Label() label = Label() title = Label() guide.text = "E2 A2 D3 G3 B3 E4" guide.font_size = '25dp' cents = cents * 100 # text to tune up or down tuner_text = '' label.color = [1, 0, 0, 1] if np.greater(-10.0, cents): tuner_text = 'Tune Up \n{:+.2f} cents'.format(cents) if np.greater(cents, 10.0): tuner_text = 'Tune Down \n{:+.2f} cents'.format(cents) if tuner_text == '': tuner_text = 'In Tune \n{:+.2f} cents'.format(cents) label.color = [0, 1, 0, 1] title.text = tuner_text title.font_size = '25dp' label.text = note_name label.font_size = '100dp' tuner_page.add_widget(guide) tuner_page.add_widget(title) tuner_page.add_widget(label)
def __init__(self, **kwargs): super(SignInScreen, self).__init__(**kwargs) title_label = Label(text="Argus Vision", markup=True) title_label.pos = (492, 600) title_label.size_hint = (None, None) title_label.font_size = (40) title_label.color = (0, 0, 0, 1) email_input = TextInput(hint_text='Email Address') email_input.focus = True email_input.write_tab = False email_input.multiline = False email_input.pos = (410, 450) email_input.size_hint = (None, None) email_input.size = (280, 30) self.email_input = email_input password_input = TextInput(hint_text='Password') password_input.password = True password_input.write_tab = False password_input.multiline = False password_input.pos = (410, 390) password_input.size_hint = (None, None) password_input.size = (280, 30) self.password_input = password_input login_button = Button(text="Login") login_button.background_color = (0.4, 0.5, 0.6, 1) login_button.pos =(450, 250) login_button.size_hint = (None, None) login_button.size = (200, 50) signup_button = Button(text="Sign Up") signup_button.background_color = (0.4, 0.5, 0.6, 1) signup_button.pos = (450, 180) signup_button.size_hint = (None, None) signup_button.size = (200, 50) forgot_pw = Label(text="[ref=][color=0000ff]Forgot your password?[/color][/ref]", markup=True) forgot_pw.pos = (500, 100) forgot_pw.size_hint = (None, None) forgot_pw.font_size = (16) forgot_pw.color = (0, 0, 0, 1) self.forgot_pw_text = "" signup_button.bind(on_release=self.go_signup) forgot_pw.bind(on_ref_press=self.forgot_pw) login_button.bind(on_release=self.login ) # partial(self.login,email_input.text,password_input.text)) Window.bind(on_key_down=self.key_press) self.add_widget(title_label) self.add_widget(email_input) self.add_widget(password_input) self.add_widget(login_button) self.add_widget(forgot_pw) self.add_widget(signup_button)
def build(): layout = GridLayout() #duas colunas. layout.cols = 2 #labels lb1 = Label() lb1.text = "Nome" lb1.font_size = 15 lb2 = Label() lb2.text = "Autor" lb2.font_size = 15 lb3 = Label() lb3.text = "Valor" lb3.font_size = 15 lb4 = Label() lb4.text = "Ano" lb4.font_size = 15 #edits globais: ed1 = TextInput(text="", multiline=False) global ed1 ed2 = TextInput(text="", multiline=False) global ed2 ed3 = TextInput(text="", multiline=False) global ed3 ed4 = TextInput(text="", multiline=False) global ed4 #botao com sua funcao bt = Button(text="Cadastrar") bt.on_press = click #Adicionando ao layout layout.add_widget(lb1) layout.add_widget(ed1) layout.add_widget(lb2) layout.add_widget(ed2) layout.add_widget(lb3) layout.add_widget(ed3) layout.add_widget(lb4) layout.add_widget(ed4) layout.add_widget(bt) return layout
def create_recipe(self): workbook = xlrd.open_workbook('my_file_name.xls') sheet = workbook.sheet_by_index(0) num_rows = sheet.nrows - 1 for xl_row in range(num_rows): #adding new num label: l_num = Label() l_num.text = str(int(sheet.cell(xl_row + 1, 0).value)) l_num.pos_hint = {"x": self.my_pos_x, "top": self.my_pos_y} l_num.font_size = 30 l_num.size_hint = (0.06, 0.1) self.add_widget(l_num) #adding new unit label: l_unit = Label() l_unit.text = sheet.cell(xl_row + 1, 1).value l_unit.pos_hint = {"x": self.my_pos_x + 0.1, 'top': self.my_pos_y} l_unit.font_size = 30 l_unit.size_hint = (0.2, 0.1) self.add_widget(l_unit) #adding new ingredient: l_ing = Label() l_ing.text = sheet.cell(xl_row + 1, 2).value l_ing.pos_hint = {"x": self.my_pos_x + 0.2, 'top': self.my_pos_y} l_ing.font_size = 30 l_ing.size_hint = (0.2, 0.1) #start updating dict: self.d[l_ing.text] = {} self.d[l_ing.text]['l_num_obj'] = l_num self.d[l_ing.text]['l_ing_obj'] = l_ing self.d[l_ing.text]['l_unit_obj'] = l_unit self.d[l_ing.text]['l_num'] = l_num.text self.d[l_ing.text]['l_ing'] = l_ing.text self.d[l_ing.text]['l_unit'] = l_unit.text self.add_widget(l_ing) #adding new (+) button: p = Button() p.text = '+' p.color = (0, 1, 1, 1) p.pos_hint = {"right": 0.85, "top": self.my_pos_y} p.font_size = 25 p.size_hint = (0.08, 0.09) p.bind(on_press=self.label_change_dynamic) self.d[l_ing.text]['plus_button'] = p self.add_widget(p) ############ #adding new (-) button: m = Button() m.text = '-' m.color = (0, 1, 1, 1) m.pos_hint = {"right": 0.75, "top": self.my_pos_y} m.font_size = 25 m.size_hint = (0.08, 0.09) m.bind(on_press=self.label_change_dynamic) self.d[l_ing.text]['minus_button'] = m self.add_widget(m) self.my_pos_y -= 0.07
def Display(self): variable1=Label(text='let Log(M)= ',pos=(-325,220)) variable1.font_size = '20dp' self.add_widget(variable1) self.v1 = TextInput(text='',pos_hint={'x': .2, 'center_y': .9}, size_hint=(.1, .1)) self.add_widget(self.v1) variable2=Label(text='let Log(N)= ',pos=(-100,220)) variable2.font_size = '20dp' self.add_widget(variable2) self.v2 = TextInput(text='',pos_hint={'x': .45, 'center_y': .9}, size_hint=(.1, .1)) self.add_widget(self.v2) self.submit = Button(pos_hint={'x': .25, 'center_y': .8}, size_hint=(.1, .05),text= 'Enter') self.add_widget(self.submit) self.back = Button(pos_hint={'x': .05, 'center_y': .05}, size_hint=(.1, .05),text= 'Back') self.add_widget(self.back)
def on_pre_enter(self, *args): # # Testing this screen values # # Context.instance.clear_scores() # Context.instance.scores[1]['total'] = 46 # Context.instance.scores[2]['total'] = 44 # Context.instance.scores[1]['score1'] = 16 # Context.instance.scores[1]['score2'] = 21 # Context.instance.scores[1]['score3'] = 8 # Context.instance.scores[2]['score1'] = 14 # Context.instance.scores[2]['score2'] = 9 # Context.instance.scores[2]['score3'] = 22 # Context.instance.get_winner() round_names = [ 'Round 1\n[b]Talk[/b]', 'Round 2\n[b]Pantomime[/b]', 'Round 3\n[b]One Word[/b]', '[color=e6e600][b]TOTAL[b][/color]' ] self.results_grid.cols = Context.instance.teams_count + 1 self.results_grid.add_widget(Widget()) for team in range(Context.instance.teams_count): team_label = Label(text=tr._('Team\n#') + str(team + 1), halign='center') team_label.font_size = .3 * team_label.width self.results_grid.add_widget(team_label) for r in range(Context.instance.rounds_count + 1): round_label = Label(text=tr._(round_names[r]), markup=True, halign='center') round_label.font_size = 0.2 * round_label.width if r == 3: round_label.font_size = 0.35 * round_label.width self.results_grid.add_widget(round_label) for team in range(Context.instance.teams_count): score_select = 'total' if r != 3: score_select = 'score' + str(r + 1) score_lbl = Label(text=str( Context.instance.scores[team + 1][score_select]), markup=True) score_lbl.font_size = 0.4 * score_lbl.width self.results_grid.add_widget(score_lbl)
def btnMMGame_release(self, btn): if (self.game.isOver): self.set_all_button_disable(True) boxLayout = BoxLayout(orientation="vertical") dlgGameOver = Popup(title="Game Over", size_hint=(None, None), size=(500, 400), auto_dismiss=False) lblWinner = Label(text="") lblWinner.font_size = 24 btnMainMenu = Button(text="MainMenu") btnMainMenu.bind(on_press=self.btnMainMenu_press) btnMainMenu.bind(on_release=dlgGameOver.dismiss) if (self.player.isWin): lblWinner.text += "You won!" elif (self.enemy.isWin): lblWinner.text += "Yay!! I won" else: lblWinner.text = "Draw! You are tough to crack" boxLayout.add_widget(lblWinner) boxLayout.add_widget(btnMainMenu) dlgGameOver.content = boxLayout dlgGameOver.open()
def build(): lbl_text = Label() lbl_text.text = 'Curso de Python e Kivy' lbl_text.italic = True lbl_text.font_size = 50 return lbl_text
def widgetWithSuccessMessage(message): widget = Label(text=message) widget.font_size = 45 widget.bold = True widget.color = (0, 1, 0, 0.75) widget.pos_hint = {"top": .66} return widget
def errorWidget(message): widget = Label(text=message) widget.font_size = 45 widget.bold = True widget.color = (1, 0, 0, 0.75) widget.pos_hint = {"top": .66} return widget
def setup(self): self.cols = 1 self.rows = 2 title_label = Label (text='[b]Forza[/b] [color=ff3333]4[/color]', markup=True) title_label.font_size = 42 inner_layout = GridLayout() inner_layout.rows = 3 inner_layout.cols = 3 inner_layout.padding = (16, 16) single_button = Button(text = "[b]SinglePlayer[/b]", markup=True) single_button.font_size = 24 single_button.bind(on_press=partial (start_game, 1)) multi_button = Button(text = "[b]MultiPlayer[/b]", markup=True) multi_button.font_size = 24 multi_button.bind(on_press=partial (start_game, 2)) exit_button = Button(text = "[b]Exit[/b]", markup=True) exit_button.font_size = 24 exit_button.bind(on_press=close_app) self.add_widget(title_label) inner_layout.add_widget(Label()) inner_layout.add_widget(Label()) inner_layout.add_widget(Label()) inner_layout.add_widget(single_button) inner_layout.add_widget(multi_button) inner_layout.add_widget(exit_button) inner_layout.add_widget(Label()) inner_layout.add_widget(Label()) inner_layout.add_widget(Label()) self.add_widget(inner_layout)
def thread_scan(self, btn): ip, nm, ports = np_scan(self.target_scan.text, self.port_range.text) btn.disabled = False btn.text = "Scan" self.clear_all_scan(self.grid_scan) self.grid_scan.rows = len(ports) + 1 for p in range(len(ports)): tmp_grid = ButtonGrid(cols=5, rows=1) tmp_grid.row_id = p tmp_grid.nm_param = ports[p] for i in range(len(ports[p])): show_str = str(ports[p][i]).strip() show_str = show_str[0:30] + "..." if len( show_str) > 30 else show_str label = Label(text=show_str, color=self.convert_rgb(34, 40, 49)) if i == 4: label.font_size = 10 tmp_grid.add_widget(label) self.grid_scan.add_widget(tmp_grid) self.clear_widgets() self.port_top.opacity = 1 self.grid_scan.size_hint_x = 1.11 self.grid_scan.opacity = 1 self.btn_find.opacity = 1 self.btn_find.size_hint_x = 0.16
def build(): lb = Label() lb.text = "Curso de Python e Kivy" lb.bold = True lb.font_size = 50 lb.pos = (0, 200) return lb
def AddKanji(self, kan): self.kanLayout.clear_widgets() label = Label(text=kan) label.font_name = "YuGothM.ttc" label.font_size = 115 label.color = [0, 0, 0, 1] self.kanLayout.add_widget(label)
def constroi_titulo(self): label = Label(text=self.titulo, bold=True) label.size_hint_y = None label.height = self.size[1] * .1 label.font_size = self.fonte_padrao label.font_size *= 1.3 self.add_widget(label)
def change_txti(self, instance, value=False): if (len(self.sel_txti.text) >= 26): self.sel_txti.text = instance.text[:25] try: Popup except: from kivy.uix.popup import Popup alert = FloatLayout() btn = Button(text="Ok", size_hint=(.4, .2), on_press=self.dismiss_popup) btn.pos_hint = {"x": 0.5 - (btn.size_hint[0] / 2), "y": 0.05} alert_msg = Label(text="O nome deve ter no\nmáximo 25 characters") alert_msg.halign = 'center' alert_msg.valign = 'middle' alert_msg.font_size = sp(17 * Window.size[1] / 600) alert_msg.size_hint = (0.4, 0.15) alert_msg.pos_hint = { "x": 0.5 - (alert_msg.size_hint[0] / 2), "y": 0.2 + btn.size_hint[1] + btn.pos_hint["y"] } alert_msg.background_color = (0.5, 1, 0.5, 0.5) alert.add_widget(alert_msg) alert.add_widget(btn) self._popup = Popup(title="Configurações", content=alert, size_hint=(0.5, 0.5)) self._popup.open() else: pass
def build(): #return Label(text="Hi! I'm a text", italic=True, font_size=50) lb = Label() lb.text="Hi! I'm a text" lb.italic=True lb.font_size=50 return lb
def build(): lb = Label() lb.text = "Hello Kivy World" lb.italic = True lb.font_size = 50 #size em tamanho de pixels return lb
def __init__(self, **kw): """Constructor: Makes a new Panel for drawing shapes Precondition: **kw are Kivy key-word arguments""" # Pass Kivy arguments to super class. super(Panel, self).__init__(**kw) # Need kivy.metrics to handle retina Macs properly rsize = [0, 0] rsize[0] = self.size[0] * dp(1) rsize[1] = self.size[0] * dp(1) # Make the background solid white color = Color(1.0, 1.0, 1.0, 1.0) self.canvas.add(color) rect = Rectangle(pos=self.pos, size=rsize) self.canvas.add(rect) # Add the label label = Label(text="Hello World!") label.color = [0.0, 0.0, 0.0, 1.0] label.size_hint = (1, 1) label.font_size = 48 * dp(1) # Again, retina Macs label.bold = True self.add_widget(label)
def build(): lb = Label() lb.text = "Curso de python e Kivy" lb.italic = True lb.font_size = 50 return lb
def on_text(self, *_): # Just get large texture: l = Label(text=self.text) l.font_size = '1000dp' # something that'll give texture bigger than phone's screen size l.texture_update() # Set it to image, it'll be scaled to image size automatically: self.texture = l.texture
def create_labels(self): """Create labels from the list entries""" for name in self.names_in_list: temp_label = Label(text=name, id=name) temp_label.font_size = 24 temp_label.color = (0, 1, 1, 1) self.root.ids.list_of_labels.add_widget(temp_label)
def setLayout(self): self.size = (1500, 1000) with self.canvas: Color(.532345, 1.0, .742, 1.0) Rectangle(size=self.size) sound_board_layout = AnchorLayout() sound_board_layout.anchor_x = "center" sound_board_layout.anchor_y = "top" sound_board_layout.size = self.size sound_board_layout.pos = self.pos sound_board_layout.size_hint = (1.0, 1.0) sound_board_layout.spacing = 50 self.title_layout.orientation = "vertical" self.title_layout.size_hint = (1.0, 1.0) self.title_layout.spacing = 10 title_label = Label() title_label.text = "Soundboard" title_label.color = [.6, .2, 1, .5] title_label.font_size = 50 title_label.font_name = "C:\\Windows\\Fonts\\Arial" title_label.size_hint = (1, 1) self.title_layout.add_widget(title_label) self.set_settings_layout() self.set_sounds() self.title_layout.add_widget(self.grid_layout) sound_board_layout.add_widget(self.title_layout) self.add_widget(sound_board_layout)
def build(): '''return Label(text ="CUrso de python e kivy", italic =True, font_size = 30) ''' lb = Label () lb.text = "CUUUUUU" lb.font_size = 30 lb.italic = True return lb
def NombreX(self, nombre): with self.wid.canvas: lblX = Label() lblX.pos = 350, -37 lblX.text = str(nombre) lblX.font_size = "4dp" lblX.color = (0, 0, 0) self.wid.add_widget(lblX)
def do_tuning(self): tuner_page = self.screens[5].layout tuner_page.clear_widgets() loadingtext = Label() loadingtext.text = 'Starting Tuner...' loadingtext.font_size = '20dp' loadingtext.bind(on_release=app.start_tuner) tuner_page.add_widget(loadingtext)
def build(): #return Label(text="Curso de Python e Kivy") # texto normal #return Label(text="Curso de Python e Kivy", italic=True) # texto com italico #return Label(text="Curso de Python e Kivy", italic=True, font_size=50) # fonte 50px lb = Label() lb.text = "Curso de Python e Kivy" lb.italic = True lb.font_size = 50 return lb
def __init__(self, title, text): popup = Popup(title=title, size_hint=(0.8, 0.8)) scrollView = ScrollView(size_hint=(1, 1)) label = Label(text=text, size_hint=(None,None), size=(1000,3000), text_size=(1000, 3000), valign='top') label.font_size=12 #TODO: Bind texture size to size (Y dimension) scrollView.add_widget(label) closeButton = Button(text='Ok', on_press=popup.dismiss, size_hint_y = 0.1) vlayout = BoxLayout(orientation='vertical') vlayout.add_widget(scrollView) vlayout.add_widget(closeButton) popup.content = vlayout popup.open()
def btnGame_release(self, btn): if (self.game.isOver): self.set_all_button_disable(True) boxLayout = BoxLayout(orientation = "vertical") dlgGameOver = Popup(title = "GameOver", size_hint = (None, None), size = (400, 400), auto_dismiss = False) lblWinner = Label(text = "Winner : ") lblWinner.font_size = 24 btnRestart = Button(text = "Restart") btnRestart.bind(on_press = self.btnRestart_press) btnRestart.bind(on_release = dlgGameOver.dismiss) btnMainMenu = Button(text = "MainMenu") btnMainMenu.bind(on_press = self.btnMainMenu_press) btnMainMenu.bind(on_release = dlgGameOver.dismiss) if (self.player1.isWin): lblWinner.text += self.player1.name + " (" + self.player1.marking + ")" elif (self.player2.isWin): lblWinner.text += self.player2.name + " (" + self.player2.marking + ")" else: lblWinner.text = "Tie" boxLayout.add_widget(lblWinner) boxLayout.add_widget(btnRestart) boxLayout.add_widget(btnMainMenu) dlgGameOver.content = boxLayout dlgGameOver.open()
def openPampaMT(self, project): self.clear_widgets() self.add_widget(self.image_back_ground) self.project = project lb_creating_the_project = Label() lb_creating_the_project.text = lang['Creating_the_Project'] lb_creating_the_project.bold = True lb_creating_the_project.font_size = 17 lb_creating_the_project.size_hint = None, None lb_creating_the_project.height = 30 lb_creating_the_project.width = 150 lb_creating_the_project.center_y = 250 lb_creating_the_project.center_x = 400 self.add_widget(lb_creating_the_project) self.progress_bar_finish = ProgressBar() self.progress_bar_finish.size_hint = None, None self.progress_bar_finish.width = 350 self.progress_bar_finish.height = 10 self.progress_bar_finish.value = 1 self.progress_bar_finish.center_x = 400 self.progress_bar_finish.center_y = 150 self.add_widget(self.progress_bar_finish) self.lb_finish = Label(text=lang['Creating...']) self.lb_finish.size_hint = None, None self.lb_finish.width = 350 self.lb_finish.height = 30 self.lb_finish.center_x = 400 self.lb_finish.center_y = 120 self.add_widget(self.lb_finish) parallel_progress_bar = threading.Thread(target=self.finish_project) parallel_progress_bar.start()
def build(self): x=Label(text='Salut Lume!') x.font_size = 48 return x
def draw_node(self, node): if type(node) is SQL_Parser.QueryTree.ProjectionNode: lbl = Label(text="P", pos=(self.pos_x, self.pos_y)) terms = Label(text=node.get_description(), pos=(self.pos_x, self.pos_y - 15)) separator = Label(text="|", pos=(self.pos_x, self.pos_y - 45)) separator.font_size = 36 self.add_widget(separator) terms.font_size = 12 self.add_widget(lbl) self.add_widget(terms) self.pos_y -= 80 self.draw_node(node.children) self.pos_y += 80 elif type(node) is SQL_Parser.QueryTree.SelectionNode: lbl = Label(text="S", pos=(self.pos_x, self.pos_y)) terms = Label(text=node.get_description(), pos=(self.pos_x, self.pos_y - 15)) separator = Label(text="|", pos=(self.pos_x, self.pos_y - 45)) separator.font_size = 36 terms.font_size = 12 self.add_widget(separator) self.add_widget(lbl) self.add_widget(terms) self.pos_y -= 80 self.draw_node(node.children) self.pos_y += 80 elif type(node) is SQL_Parser.QueryTree.ThetaJoinNode: if node.get_description() == "X": lbl = Label(text=node.get_description(), pos=(self.pos_x, self.pos_y)) else: lbl = Label(text="|X|", pos=(self.pos_x, self.pos_y)) terms = Label(text=node.get_description(), pos=(self.pos_x, self.pos_y - 15)) terms.font_size = 12 self.add_widget(terms) separator = Label(text='__________________', pos=(self.pos_x, self.pos_y - 45)) separator.font_size = 36 self.add_widget(separator) separator2 = Label(text='|', pos=(self.pos_x, self.pos_y - 35)) separator2.font_size = 36 self.add_widget(separator2) self.add_widget(lbl) self.pos_x -= 145 self.pos_y -= 80 separator3 = Label(text='|', pos=(self.pos_x, self.pos_y + 15)) separator3.font_size = 18 self.add_widget(separator3) self.draw_node(node.children[0]) self.pos_x += 289 separator4 = Label(text='|', pos=(self.pos_x, self.pos_y + 15)) separator4.font_size = 18 self.add_widget(separator4) self.draw_node(node.children[1]) self.pos_x += 145 self.pos_y += 80 elif type(node) is SQL_Parser.QueryTree.Table: lbl = Label(text=node.get_description(), pos=(self.pos_x, self.pos_y)) self.add_widget(lbl)
def init(self): global poker_width, poker_height poker_width = game.width / 10 poker_height = game.width / 7 with self.canvas: Color(rgb = [0.0, 0.3, 0.0]) Rectangle(size = self.size) score_pad_hint = Label(text = "NS\nEW") score_pad_hint.size = self.width / 16, self.height / 7 score_pad_hint.bold = True score_pad_hint.font_size = 30 score_pad_hint.color = [1, 1, 1, 1] score_pad_hint.pos = 0, self.height - score_pad_hint.height self.add_widget(score_pad_hint) self.score_pad = ScorePad() self.score_pad.size = score_pad_hint.size self.score_pad.bold = True self.score_pad.font_size = 30 self.score_pad.color = score_pad_hint.color self.score_pad.pos = score_pad_hint.pos[0] + score_pad_hint.width, score_pad_hint.pos[1] self.add_widget(self.score_pad) self.player_list = [] for name in "nsew": player = Player(name) setattr(self, "player_" + name, player) self.player_list.append(player) self.player_n.next = self.player_w self.player_w.next = self.player_s self.player_s.next = self.player_e self.player_e.next = self.player_n self.player_n.buddy = self.player_s self.player_s.buddy = self.player_n self.player_w.buddy = self.player_e self.player_e.buddy = self.player_w self.score_pad.refresh() self.pk_list = [] pk_seq = (["s5"] + [c + "j" for c in "rb"] + [c + "5" for c in "hcd"] + [c + n for n in "32" for c in "shcd"] + [c + n for c in "shcd" for n in "akqjt98764"]) for i, pk_name in enumerate(pk_seq): for j in xrange(2): pk = Poker(i * 2 + j, pk_name, source = os.path.join("image", "%s.bmp" % pk_name)) self.add_widget(pk) self.pk_list.append(pk) self.ok_button = OkButton(text = "OK", font_size = 30) self.ok_button.size = self.width / 16, self.width / 32 self.ok_button.pos = self.width - self.ok_button.width * 2, 20 + poker_height + 30 self.add_widget(self.ok_button) self.thinking_pad = Label(text = "THINKING") self.thinking_pad.size = poker_width * 3 / 2, 50 self.thinking_pad.bold = True self.thinking_pad.font_size = 20 self.thinking_pad.color = [1, 1, 1, 1] self.thinking_pad.pos = self.width, self.height self.add_widget(self.thinking_pad) self.turn = None self.start_game()
def draws_lines_Z(x0, y0, dx, dy, fzoom,fzoomy, border, xmin, xmax, ymin, ymax, limx, limy, label_y, scale_y, component): xf = x0 + dx yf = y0 + dy deca_x = range(xmin, xmax + 1) deca_y = range(ymin, ymax, 5) # if limy == 90: # lb_y = [0, 45, 90] # elif limy == 180: # lb_y = [0, 90, 180] lb_y = [-15, -10, -5, 0, 5, 10, 15] #lb_y = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] scale = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000] scale_log = [] for i in scale: scale_log.append(log10(i)) scale_log_zoom = [] for i in scale_log: scale_log_zoom.append(i * fzoom) lay = FloatLayout() with lay.canvas: Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, xf, y0], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, x0, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[xf, y0, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, yf, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Color(rgba=[.2, .2, .2, 1.]) Ellipse(size=[6, 6], pos=[int(((dx / 3) * 2) + x0 + 5), yf + 10]) c = 0 for i in scale_log_zoom: if scale[c] > limx: continue else: Color(rgba=[0., 0., 0., 1.]) Line(points=[i + x0, y0, i + x0, y0 - 5]) c += 1 for i in deca_y: i = int(i * fzoomy) Color(rgba=[0., 0., 0., 1.]) Line(points=[x0 - 5, i + y0, x0, i + y0]) for i in deca_y: i = int(i * fzoomy) Color(rgba=[0., 0., 0., 1.]) Line(points=[xf + 5, i + y0, xf, i + y0]) if scale_y == True: for i in lb_y: lb_phi = Label() lb_phi.color = [0, 0, 0, 1] lb_phi.markup = True lb_phi.text = str(i) lb_phi.size_hint = None, None lb_phi.height = 30 lb_phi.width = 30 if limy == 180: y = (i/2 * fzoomy) + y0 elif limy == 90: y = ((i+15) * fzoomy) + y0 lb_phi.center_x = xf + 25 lb_phi.center_y = y lay.add_widget(lb_phi) for i in deca_x: if deca_x[0] < 0: pos = -deca_x[0] lb = Label() lb.color = [0,0,0,1] lb.markup = True lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]' lb.size_hint = None, None lb.height = 30 lb.width = 30 x = int((x0 - 15) + ((i + pos) * fzoom)) lb.pos = x, y0 - 30 lay.add_widget(lb) lb_title = Label() lb_title.color = [0, 0, 0, 1.] lb_title.font_size = 17 lb_title.text = 'Z' + component lb_title.size_hint = None, None lb_title.height = 30 lb_title.width = 370 lb_title.center_x = int((lb_title.width/2) + x0) - 25 lb_title.center_y = yf + 15 #lay.add_widget(lb_title) if label_y == True: lb_rho_ohm_meter = LabelRot() lb_rho_ohm_meter.size_hint = None, None lb_rho_ohm_meter.height = 100 lb_rho_ohm_meter.width = 25 lb_rho_ohm_meter.markup =True lb_rho_ohm_meter.italic = True lb_rho_ohm_meter.text = 'φ (graus)' lb_rho_ohm_meter.color = [0., 0., 0., 1.] lb_rho_ohm_meter.center_x = x0 - 40 lb_rho_ohm_meter.center_y = int(y0 + dy/2) lay.add_widget(lb_rho_ohm_meter) bt_rho_xy = PointPlotEX() bt_rho_xy.center_x = int(((dx / 3) + x0) - 50) bt_rho_xy.center_y = yf + 14 lb_rho_xy = Label() lb_rho_xy.size_hint = None, None lb_rho_xy.height = 30 lb_rho_xy.width = 30 lb_rho_xy.center_x = int((dx / 3) + x0 - 20) lb_rho_xy.center_y = yf + 15 lb_rho_xy.markup = True lb_rho_xy.text = 'Re Z[sub][size=15]'+ component +'[/size][/sub]' lb_rho_xy.color = [.2, .2, .2, 1.] lb_rho_xy.font_size = 17 lay.add_widget(bt_rho_xy) lay.add_widget(lb_rho_xy) lb_rho_yx = Label() lb_rho_yx.size_hint = None, None lb_rho_yx.height = 30 lb_rho_yx.width = 30 lb_rho_yx.center_x = int(((dx / 3) * 2) + x0 + 40) lb_rho_yx.center_y = yf + 15 lb_rho_yx.markup = True lb_rho_yx.text = 'Im Z[sub][size=15]'+ component +'[/size][/sub]' lb_rho_yx.color = [.2, .2, .2, 1.] lb_rho_yx.font_size = 17 lay.add_widget(lb_rho_yx) return lay
def draws_lines_rho( x0, y0, dx, dy, fzoom, border, xmin, xmax, ymin, ymax, limx, limy, label_y): xf = x0 + dx yf = y0 + dy deca_x = range(xmin, xmax + 1) deca_y = range(ymin, ymax + 1) scale = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000] scale_log = [] for i in scale: scale_log.append(log10(i)) scale_log_zoom = [] for i in scale_log: scale_log_zoom.append(i * fzoom) lay = FloatLayout() with lay.canvas: Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, xf, y0], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, x0, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[xf, y0, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, yf, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Color(rgba=[.2, .2, .2, 1.]) Ellipse(size=[6, 6], pos=[int(((dx / 3) * 2) + x0 - 23), yf + 7]) c = 0 for i in scale_log_zoom: if scale[c] > limx: continue else: Color(rgba=[0., 0., 0., 1.]) Line(points=[i + x0, y0, i + x0, y0 - 5]) c += 1 c = 0 for i in scale_log_zoom: if scale[c] > limy: continue else: Color(rgba=[0, 0, 0, 1]) Line(points=[x0, i + y0, x0 - 5, i + y0]) c += 1 c = 0 for i in scale_log_zoom: if scale[c] > limy: continue else: Color(rgba=[0, 0, 0, 1]) Line(points=[xf, i + y0, xf + 5, i + y0]) c += 1 for i in deca_y: if deca_y[0] < 0: pos = -deca_y[0] lb = Label() lb.color = [0, 0, 0, 1] lb.markup = True lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]' lb.size_hint = None, None lb.height = 30 lb.width = 30 y = int((y0 - 20) + ((i + pos) * fzoom)) lb.pos = x0 - 35, y lay.add_widget(lb) for i in deca_x: if deca_x[0] < 0: pos = -deca_x[0] lb = Label() lb.color = [0, 0, 0, 1] lb.markup = True lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]' lb.size_hint = None, None lb.height = 30 lb.width = 30 x = int((x0 - 20) + ((i + pos) * fzoom)) lb.pos = x + 5, y0 - 35 lay.add_widget(lb) if label_y == True: lb_rho_ohm_meter = LabelRot() lb_rho_ohm_meter.size_hint = None, None lb_rho_ohm_meter.height = 100 lb_rho_ohm_meter.width = 25 lb_rho_ohm_meter.markup = True lb_rho_ohm_meter.italic = True lb_rho_ohm_meter.text = 'ρ (Ω.m)' lb_rho_ohm_meter.color = [0., 0., 0., 1.] lb_rho_ohm_meter.center_x = x0 - 40 lb_rho_ohm_meter.center_y = int(y0 + dy / 2) lay.add_widget(lb_rho_ohm_meter) bt_rho_xy = PointPlotEX() bt_rho_xy.center_x = int(((dx/3) + x0)-20) bt_rho_xy.center_y = yf + 10 lb_rho_xy = Label() lb_rho_xy.size_hint = None, None lb_rho_xy.height = 30 lb_rho_xy.width = 30 lb_rho_xy.center_x = int((dx/3) + x0) lb_rho_xy.center_y = yf + 15 lb_rho_xy.markup = True lb_rho_xy.text = 'ρ[sub]xy[/sub]' lb_rho_xy.color = [.2, .2, .2, 1.] lb_rho_xy.font_size = 23 lay.add_widget(bt_rho_xy) lay.add_widget(lb_rho_xy) lb_rho_yx = Label() lb_rho_yx.size_hint = None, None lb_rho_yx.height = 30 lb_rho_yx.width = 30 lb_rho_yx.center_x = int(((dx / 3) * 2) + x0) lb_rho_yx.center_y = yf + 15 lb_rho_yx.markup = True lb_rho_yx.text = 'ρ[sub]yx[/sub]' lb_rho_yx.color = [.2, .2, .2, 1.] lb_rho_yx.font_size = 23 lay.add_widget(lb_rho_yx) return lay