def __init__(self, image = None, file = None, **kwds): if file: from Images import Image image = Image(file) View.__init__(self, **kwds) if image: self.size = image.size self._image = image
def __init__(self, image=None, file=None, **kwds): if file: from Images import Image image = Image(file) View.__init__(self, **kwds) if image: self.size = image.size self._image = image
def __init__(self, base_view, page_setup): print("TextEditorPrintView:") ### print("...paper_size =", page_setup.paper_size) ### print("...margins =", page_setup.margins) ### print("...page_size =", page_setup.page_size) ### View.__init__(self) self.base_view = base_view self.width = page_setup.page_width self.page_height = page_setup.page_height self.lay_out_text() lines_per_page = int(page_setup.page_height / base_view.font.line_height) self.lines_per_page = lines_per_page num_lines = len(self.lines) self.num_pages = (num_lines + lines_per_page - 1) // lines_per_page self.height = self.num_pages * self.page_height
def __init__(self, base_view, page_setup): print "TextEditorPrintView:" ### print "...paper_size =", page_setup.paper_size ### print "...margins =", page_setup.margins ### print "...page_size =", page_setup.page_size ### View.__init__(self) self.base_view = base_view self.width = page_setup.page_width self.page_height = page_setup.page_height self.lay_out_text() lines_per_page = int(page_setup.page_height / base_view.font.line_height) self.lines_per_page = lines_per_page num_lines = len(self.lines) self.num_pages = (num_lines + lines_per_page - 1) // lines_per_page self.height = self.num_pages * self.page_height
def __init__(self): self.root = Tk.Tk() self.model = Experiments.Experiments() self.current_exp = None self.current_measurement = None self.current_burst = None self.view = View.View(self.root, self) # alias self.graph_results = self.view.archi.analyze_area.resultArea_gui.graph_results # self.model.logger = self.view.logger self.root.protocol( "WM_DELETE_WINDOW", self.on_quit ) # Exit when x pressed, notice that its the name of the function 'self.handler' and not a method call self.handler()
def __init__(self, dataset_name='ffhq'): self.root = Tk() self.view = View(self.root) self.img_ratio = 2 self.style_clip = StyleCLIP(dataset_name) self.view.neutral.bind("<Return>", self.text_n) self.view.target.bind("<Return>", self.text_t) self.view.alpha.bind('<ButtonRelease-1>', self.ChangeAlpha) self.view.beta.bind('<ButtonRelease-1>', self.ChangeBeta) self.view.set_init.bind('<ButtonPress-1>', self.SetInit) self.view.reset.bind('<ButtonPress-1>', self.Reset) self.view.bg.bind('<Double-1>', self.open_img) self.drawn = None self.view.target.delete(1.0, "end") self.view.target.insert("end", self.style_clip.target) # self.view.neutral.delete(1.0, "end") self.view.neutral.insert("end", self.style_clip.neutral)
def __init__(self,dataset_name='ffhq'): self.root = Tk() self.view=View(self.root) self.img_ratio=2 # model_path='/cs/labs/danix/wuzongze/composite_full/full/model_history/good/Open_MobileNetV2_400_2.h5' #Coco_MobileNetV2_1000_0,Open_MobileNetV2_400_2 self.style_clip=StyleCLIP(dataset_name) # self.box=[10,20,30,40] # self.view.bg.bind('<ButtonPress-1>', self.onStart) # self.view.bg.bind('<B1-Motion>', self.onGrow) # self.view.bg.bind('<Double-1>', self.open_img) # self.view.bg.bind('<ButtonRelease-1>', self.MakeHole) # self.view.set_p.bind('<ButtonPress-1>', self.SetParameters) # self.view.rset_p.bind('<ButtonPress-1>', self.ResetParameters) # self.view.set_p.command= self.SetParameters # self.view.set_category.bind("<<ComboboxSelected>>", self.ChangeDataset) self.view.neutral.bind("<Return>", self.text_n) self.view.target.bind("<Return>", self.text_t) self.view.alpha.bind('<ButtonRelease-1>', self.ChangeAlpha) self.view.beta.bind('<ButtonRelease-1>', self.ChangeBeta) self.view.set_init.bind('<ButtonPress-1>', self.SetInit) self.view.reset.bind('<ButtonPress-1>', self.Reset) self.view.bg.bind('<Double-1>', self.open_img) self.drawn = None self.view.target.delete(1.0, "end") self.view.target.insert("end", self.style_clip.target) # self.view.neutral.delete(1.0, "end") self.view.neutral.insert("end", self.style_clip.neutral)
def new_game_ind(self): # create GUI root = Tk() self.view = View(root) grid_btn_array = self.view.get_grid_btns() i = 0 for btn in grid_btn_array: btn.config(command=lambda x=i: self.callback(x)) i += 1 rotate_btn_array = self.view.get_rotate_btns() i=0 for btn in rotate_btn_array: btn.config(command=lambda x=i: self.rotate_callback(x)) i += 1 self.view.filemenu.add_command(label='Exit', command=lambda root=root:self.quit(root)) self.view.enable_grid() self.client.look_game_req() #Event handler for the Exit-event (user clicks 'x') root.protocol("WM_DELETE_WINDOW", lambda root=root:self.quit(root)) root.mainloop()
elif '<desc>' in lines[i]: i += 1 while not '<narr>' in lines[i]: query = '{} {}'.format( query, lines[i].replace('<title>', '').replace('\n', '')) i += 1 queries_list.append((id, query)) i += 1 for query_tuple in queries_list: docs_result = self.start_query_search(query_tuple[1], chosen_cities) tmp = (query_tuple[0], query_tuple[1], docs_result) current_queries_results.append(tmp) self.queries_docs_results.append(tmp) return self.queries_docs_results def get_doc_five_entities(self, doc_id): return self.searcher.docs_dict[doc_id].five_entities """ Script Description: This script starts the program by initializing Main object, GUI IndexView object and calling a function to open the index window. """ if __name__ == "__main__": controller = Main() view = View(controller) view.start_index_view()
def __init__(self, size, **kwargs): View.__init__(self, **kwargs) self.images = GraphView.DUMMY_IMLIST self.im_num = 0 self.size = size
def __init__(self, image, **kwrgs): self.image = image View.__init__(self, **kwrgs)
def __init__(self, master): self.master = master self.file1, self.file2 = '', '' self.file1_cont, self.file2_cont = '', '' self.view = View.View(master, self) self.model = Model.Reader()
if __name__ != '__main__': print('This main programm !\nRun this module !') exit() import json from GUI import View, ViewFile from Gamer import Gamer from Table import Table from Croupier import Croupier view = View() view_file = ViewFile() # Выводим приветственное сообщение, главное меню и ждём действий пользователя view.show_start_message() # Показывает что игра может быть загружена is_restore_game = 0 _flag = ['', '', '', {}] # Загрузка части лог файла block_log = view_file.read_part_log(10) if block_log: # Проверка корректности завершения прошлого сеанса игры if block_log[-1].find('End game') == -1: # Завершение игры прошло не корректно, можно восстановить предыдущую игру is_restore_game = 1 # log начала игры view_file.write_game_log('---------------Start game BlackJack---------------')
from GUI import View, Button, FileDialogs, Label, Font
def resized(self, delta): View.resized(self, delta) TerminalPyGUIViewBase.resized(self, delta)
def __init__(self, **kwargs): self._refresh_font(kwargs['model'].cfg) TerminalPyGUIViewBase.__init__(self, **kwargs) View.__init__(self, **kwargs)
class GameController: def __init__(self, client, tcp): self.client = client # create game board self.tcp = tcp self.rotate_params = { 0: [0, 1], 1: [0, 0], 2: [1, 1], 3: [1, 0], 4: [2, 1], 5: [2, 0], 6: [3, 1], 7: [3, 0] } self.trans_array = {"0" : " ", "1" : "X", "2" : "O"} # start new game def new_game_ind(self): # create GUI root = Tk() self.view = View(root) grid_btn_array = self.view.get_grid_btns() i = 0 for btn in grid_btn_array: btn.config(command=lambda x=i: self.callback(x)) i += 1 rotate_btn_array = self.view.get_rotate_btns() i=0 for btn in rotate_btn_array: btn.config(command=lambda x=i: self.rotate_callback(x)) i += 1 self.view.filemenu.add_command(label='Exit', command=lambda root=root:self.quit(root)) self.view.enable_grid() self.client.look_game_req() #Event handler for the Exit-event (user clicks 'x') root.protocol("WM_DELETE_WINDOW", lambda root=root:self.quit(root)) root.mainloop() def quit(self, root): self.tcp.req_close_connection() root.destroy() def start_game_ind(self): self.view.set_infotext("Game starting") # your turn notification def your_turn_ind(self): self.view.set_infotext("Your turn - place mark") # receive invalid move notification def invalid_move_ind(self): self.view.set_infotext("Invalid move") # receive game end result def game_end_ind(self, end_status): if end_status == 0: self.view.set_infotext("Game Over") self.view.popup("Draw!") else: self.view.set_infotext("Game Over") self.view.popup("Player {} won!".format(end_status)) # update board with data received from communication layer def update_board_ind(self, board_info): board = list() for row in board_info: board.extend(row) for i in range(len(board)): board[i] = self.trans_array[board[i]] self.view.update(board) # place marble and send the data to communication layer def callback(self, id): x = id % 6 y = int(id / 6) self.client.m_place_req(x, y) # click rotate button and send the data to communication layer def rotate_callback(self, id): print("Clicked btn {}".format(id)) self.client.rotate_board_req(*self.rotate_params[id])
def __init__(self, name, color, **kwds): self.name = name self.color = color View.__init__(self, size=(60, 60), **kwds)
import tkinter as tk from GUI import View root = tk.Tk() view = View(root) root.mainloop()
def setup_menus(self, m): View.setup_menus(self, m) super(TerminalPyGUIView, self).setup_menus(m)
def __init__(self, name, color, **kwds): self.name = name self.color = color View.__init__(self, size = (60, 60), **kwds)
def __init__(self, id, **kwds): View.__init__(self, size=win_icon_size, **kwds) # hwnd = self._win.GetSafeHwnd() self.win_icon = win_load_icon(id)
def __init__(self, id, **kwds): View.__init__(self, size=win_icon_size, **kwds) #hwnd = self._win.GetSafeHwnd() self.win_icon = win_load_icon(id)
def __init__(self, pixmap, **kwds): self.pixmap = pixmap View.__init__(self, **kwds)