本文整理汇总了Python中kivy.uix.modalview.ModalView.open方法的典型用法代码示例。如果您正苦于以下问题:Python ModalView.open方法的具体用法?Python ModalView.open怎么用?Python ModalView.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.modalview.ModalView
的用法示例。
在下文中一共展示了ModalView.open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_press_bt_selected_two_equal_periods
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def on_press_bt_selected_two_equal_periods(self):
popup = ModalView(size_hint=(None,None))
popup.add_widget(Label(text=lang['Selected_two_equal_periods'],size_hint=(None,None),height=30, width=300))
popup.height = 40
popup.width = 300
popup.open()
print('selected two equal periods')
示例2: GameOverNote
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def GameOverNote(self,survivaltime):
popup = ModalView(size_hint=(0.75, 0.5))
victory_label = Label(text="Game Over\n" + "%0.2f"%survivaltime + " sec", font_size=50)
popup.add_widget(victory_label)
popup.bind(on_dismiss=game.reset)
popup.bind(on_press=popup.dismiss)
popup.open()
示例3: save_new
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def save_new(self, *args):
print("SAVE_NEW")
print("path", path)
# function to get text from text boxes
servers = open(path +"\\" + 'server.json')
try:
ServerDict = json.load(servers)
except ValueError:
ServerDict = {}
servers.close()
grid = self.children[0]
temp_list = [i.text for i in grid.children[4:0:-1]] # part of list becasue BoxLayout must be excluded
# now need to check if all inputs have text
nonBlock = True
for item in temp_list:
if len(item) < 1:
nonBlock = False
if nonBlock == True:
if temp_list[0] in ServerDict.keys():
p = ModalView(size_hint=(0.7, 0.1))
p.add_widget(Label(text="Wybierz inna nazwe."))
p.open()
else: # here stuff will be saved
ServerDict[temp_list[0]] = {"address":temp_list[1], "login":temp_list[2], "passw":temp_list[3]}
servers = open(path+"\\"+'server.json', 'w')
json.dump(ServerDict, servers)
servers.close()
self.dismiss()
else:
p = ModalView(size_hint=(0.7, 0.1))
p.add_widget(Label(text="Błędne dane. Sprawdź i popraw..."))
p.open()
示例4: Load
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def Load(self):
"""
Load from the Disk
Button > Load()
"""
from functools import partial
from kivy.uix import filechooser
from kivy.uix.filechooser import FileChooserListView, FileChooserIconView
main = ModalView(size_hint=(.8,.8)) # everything on this Modal is 80%
BL = BoxLayout(portrait="vertical")
FLV = FileChooserListView(path="coreEngine/Saved",)
def cTexloader(instance):
Selected = FLV.selection
Selected_Attr = Selected
LStoString = str(Selected_Attr[0])
self.Loader_NoErr(ctexSaved=LStoString,fixedPath=LStoString)
Load_Btn = Button(text="Load this File")
Load_Btn.bind(on_press=cTexloader)
main.add_widget(BL)
BL.add_widget(FLV)
BL.add_widget(Load_Btn)
main.open()
示例5: helpView
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def helpView(self):
"""
Show Help/Guides modal (show when help button pressed)
"""
widgets = FloatLayout(size_hint=(None,None),
size=(300,300),
background_color=parse_color("#FF9933"),)
sizer = NumericProperty(30)
main = ModalView(title_color=parse_color("#FF9933"),
title_size=(25),
seperator_height=("9dp"),
separator_color=parse_color("#FF9933"),
#background_color=parse_color("#FF9933"),
size_hint=(None,None),
size=(400,620),
content = Image(source="coreEngine/Images/about.png"),
)
white_bar = Image(source="coreEngine/Images/whitebar.png",
pos=(123,123),
size=(400,400))
logo = Image(source="coreEngine/Images/about.png")
main.add_widget(logo, 1)
main.open()
示例6: button_pressed
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def button_pressed(self, button):
player = {1: 'X', -1: 'O'}
colours = {1: (0, 1, 0, 1), -1: (1, 0, 0, 1)}
x, y, z, w = button.coords
already_played = self.board[x, y, z, w] != 0
if not already_played:
self.board[x, y, z, w] = self.current_player
button.text = player[self.current_player]
button.background_color = colours[self.current_player]
winner = None
if check_win(move = button.coords, player = self.current_player, \
moves = self.move_list[self.current_player], \
board = self.board):
winner = '{0} wins!'.format(player[self.current_player])
elif 0 not in self.board:
winner = 'Draw... nobody wins!'
if winner:
popup = ModalView(size_hint=(0.75, 0.5))
victory_label = Label(text=winner, font_size=50)
popup.add_widget(victory_label)
popup.bind(on_dismiss=self.reset)
popup.open()
else:
self.current_player *= -1
示例7: button_pressed
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def button_pressed(self, button):
colours = {-1: (1, 0, 0, 1), 1: (0, 1, 0, 1)} # (r, g, b, a)
row, column = button.coords
if button.pressed == 1:
button.text = {-1: Finish.surrounded(row, column), 1: 'X'}[self.status[row][column]]
button.background_color = colours[self.status[row][column]]
print ('{} button clicked!'.format(button.coords))
button.pressed = 0
if Finish.board[row][column] == 1:
self.treasuresfound = self.treasuresfound + 1
if self.treasuresfound == 9:
popup = ModalView(size_hint=(0.75, 0.5))
endlabel = Button(text="You won !", font_size=50)
endlabel.background_color = (0, 1, 0, 1)
popup.add_widget(endlabel)
popup.bind(on_dismiss=self.reset)
popup.open()
else:
self.attempts = self.attempts - 1
if self.attempts == 0:
popup = ModalView(size_hint=(0.75, 0.5))
endlabel = Button(text="Try again", font_size=50)
popup.add_widget(endlabel)
popup.bind(on_dismiss=self.reset)
popup.open()
示例8: on_status
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def on_status(self, instance, new_value):
status = new_value
# Sum each row, column and diagonal.
# Could be shorter, but let's be extra
# clear what’s going on
sums = [sum(status[0:3]), # rows
sum(status[3:6]), sum(status[6:9]), sum(status[0::3]), # columns
sum(status[1::3]), sum(status[2::3]), sum(status[::4]), # diagonals
sum(status[2:-2:2])]
# Sums can only be +-3 if one player
# filled the whole line
winner = None
if -3 in sums:
winner = 'Крестик Выиграл!'
elif 3 in sums:
winner = 'Нолик Выиграл!'
elif 0 not in self.status:
winner = 'Ничья....!'
if winner:
popup = ModalView(size_hint=(0.75, 0.5))
victory_label = Label(text=winner, font_size=50)
popup.add_widget(victory_label)
popup.bind(on_dismiss=self.reset)
popup.open()
示例9: on_status
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def on_status(self, instance, new_value):
status = new_value
# Sum each row, col and diag
# Could be shorter, but let's be extra
# clear what's going on
sums = [#rows
sum(status[0:3]),
#columns
sum(status[3:6]),
sum(status[6:9]),
sum(status[0::3]),
#diagonals
sum(status[1::3]),
sum(status[2::3]),
sum(status[::4]),
sum(status[2:-2:2])]
# Sums can only be +-3 if one player
# filled the whole line
winner = ''
if 3 in sums:
winner = '{} win!'.format('O')
elif -3 in sums:
winner = '{} win!'.format('X')
elif 0 not in self.status: #Grid full
winner = 'Draw...Nobody wins!'
if winner:
popup = ModalView(size_hint = (0.75 , 0.5 ))
victory_label = Label(text = winner, font_size = 50)
popup.add_widget(victory_label)
popup.bind(on_dismiss = self.reset)
popup.open()
示例10: choose_color
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def choose_color(self):
view = ModalView()
clrpr = ColorPicker()
view.add_widget(clrpr)
view.open()
def on_color(instance, value):
self.color_picked = value
clrpr.bind(color=on_color)
示例11: launchSimpleModal
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def launchSimpleModal(text):
view = ModalView(size_hint=(0.4, 0.2))
content = SimpleModal(text=text)
view.add_widget(content)
# bind the on_press event of the button to the dismiss function
content.bind(on_press=view.dismiss)
# open the view
view.open()
示例12: showGraph
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def showGraph (self):
if self.goals:
show = ModalView (size_hint = (1, 1))
close = Factory.ImageButton (size_hint = (1, 1))
close.children[0].source = "graph/" + os.listdir ("graph")[self.current]
close.children[0].size_hint = (1, 1)
close.bind (on_press = show.dismiss)
show.add_widget (close)
show.open()
示例13: showLoading
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def showLoading(self,txt="Loading ..."):
cnt=BoxLayout()
lbl=Label(text=txt)
mdl=ModalView(size_hint=(0.9,0.3),auto_dismiss=False)
cnt.add_widget(lbl)
mdl.add_widget(cnt)
mdl.open()
self.loader=mdl
self.setAnimation(self.loader)
示例14: on_touch_down
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def on_touch_down(self, touch):
if self.collide_point(touch.pos[0], touch.pos[1]):
content = Rozpoziomowany()
view = ModalView(size_hint=(None, None), size=(400, 400), auto_dismiss=False)
view.add_widget(content)
btn = content.ids['przejscie']
btn2 = content.ids['menu']
btn.bind(on_press=view.dismiss)
btn2.bind(on_press=view.dismiss)
view.open()
示例15: on_preferences
# 需要导入模块: from kivy.uix.modalview import ModalView [as 别名]
# 或者: from kivy.uix.modalview.ModalView import open [as 别名]
def on_preferences(self, *args):
settings_view = SettingsWithNoMenu()
base_dir = self._settings.base_dir
settings_view.add_json_panel('Dashboard Preferences', self._settings.userPrefs.config, os.path.join(base_dir, 'resource', 'settings', 'dashboard_settings.json'))
popup = ModalView(size_hint=DashboardView._POPUP_SIZE_HINT)
popup.add_widget(settings_view)
popup.bind(on_dismiss=self._popup_dismissed)
popup.open()
self._popup = popup