def __init__(self): Application.__init__(self) self.blob_type = FileType(name = "Blob Document", suffix = "blob", #mac_creator = "BLBE", mac_type = "BLOB", # These are optional ) self.file_type = self.blob_type self.blob_cursor = Cursor("blob.tiff")
def __init__(self, cfg): Application.__init__(self) self.cfg = cfg self.current_tab = None self.conn_history = [] self.menus = basic_menus(self.cfg.get_session_names()) self._cls_view = self._select_view_render()
def __init__(self): Application.__init__(self) #define a file type for the app's files #this allows us to the app to recognize the files it can open self.file_type = FileType(name = 'Line Document', suffix = 'ln') #we can create new cursors to use in our views self.line_cursor = Cursor("crosshair.tiff")
def __init__(self): Application.__init__(self) #define a file type for the app's files #this allows us to the app to recognize the files it can open self.file_type = FileType(name='Line Document', suffix='ln') #we can create new cursors to use in our views self.line_cursor = Cursor("crosshair.tiff")
def __init__(self): Application.__init__(self) self.gesture_type = FileType(name = "GestureFile", suffix = "ges", #mac_creator = "BLBE", mac_type = "BLOB", # These are optional ) self.file_type = self.gesture_type #MENUS menus = basic_menus() my_menu = Menu("Widget", [("Swizzle", 'swiz_cmd'), ("Defibrillate", 'defib_cmd')]) menus.append(my_menu) self.menus = menus
def setup_menus(self, m): Application.setup_menus(self, m) m.paste_cmd.enabled = application().query_clipboard() m.new_window_cmd.enabled = 1 m.open_session_cmd.enabled = 1 win = self.get_target_window() close_tab_enabled = False if win and win.tabview: tab_view = win.tabview close_tab_enabled = tab_view.selected_index >= 0 m.close_tab_cmd.enabled = 1 if close_tab_enabled else 0 m.next_tab_cmd.enabled = True m.prev_tab_cmd.enabled = True
def application(): """Returns the global Application object. Creates a default one if needed.""" global _application if not _application: from GUI import Application _application = Application() return _application
def __init__(self): Application.__init__(self, title='Software de manejo de Eventos') self.event_manager_filetype = FileType(name = "Documento de Eventos",\ suffix = "event") self.file_type = self.event_manager_filetype
def main(): window = tk.Tk() app = Application(window) window.mainloop()
def __init__(self,parent): self.parent = parent self.model = PlayRecommender() self.view = Application(master=parent, vc=self) self.capture = CardCapture()
class MyController(): trump_picked = False last_hand = None last_comm = None last_play_func = None def __init__(self,parent): self.parent = parent self.model = PlayRecommender() self.view = Application(master=parent, vc=self) self.capture = CardCapture() # Event Handlers def add_hand_cards(self): print('Add Hand') if not self.trump_picked: self.no_trump() else: cards = self.capture.get() #cards = [ Card('8','H'), Card('3','H'), Card('8','S'), Card('Q','C') ] ####################### self._add_hand(cards) self.reset_advice() print('---') def _add_hand(self, cards): if cards is None: return print('Add to Hand: {}'.format(cards)) self.model.add_to_hand(cards) print('Hand: {}'.format(self.model.hand)) self.view.set_hand(self.model.hand) self.last_hand = cards def clear_hand(self): print('Clear Hand') if not self.trump_picked: self.no_trump() else: self.model.reset_hand() print('Hand: {}'.format(self.model.hand)) self.view.set_hand(self.model.hand) self.reset_advice() print('---') self.last_hand = None def add_comm_cards(self): print('Add Comm') if not self.trump_picked: self.no_trump() else: cards = self.capture.get() #cards = [ Card('J','C'), Card('8','C'), Card('8','D') ] ################# self._add_comm(cards) self.reset_advice() print('---') def _add_comm(self,cards): if cards is None: return print('Add to Comm: {}'.format(cards)) self.model.add_to_community(cards) print('Comm: {}'.format(self.model.comm)) self.view.set_comm(self.model.comm) self.last_comm = cards def clear_comm(self): print('Clear Comm') if not self.trump_picked: self.no_trump() else: self.model.reset_community() print('Comm: {}'.format(self.model.comm)) self.view.set_comm(self.model.comm) self.reset_advice() print('---') self.last_comm = None def defend(self): print('Defend') if not self.trump_picked: self.no_trump() else: advc = self.model.get_defend_advice() print('Advice: {}'.format(advc)) self.view.set_defend_advice(advc) print('---') self.last_play_func = self.defend def attack(self): print('Attack') if not self.trump_picked: self.no_trump() else: advc = self.model.get_attack_advice() print('Advice: {}'.format(advc)) self.view.set_attack_advice(advc) print('---') self.last_play_func = self.attack def fight(self): print('Fight') if not self.trump_picked: self.no_trump() else: advc = self.model.get_additional_attack_advice() print('Advice: {}'.format(advc)) self.view.set_fight_advice(advc) print('---') self.last_play_func = self.fight def reset_advice(self): self.last_play_func = None self.view.clear_advice() def no_trump(self): print('ERROR: Trump Suit not Defined') def pick_hearts(self): self.pick_trump('H') def pick_spades(self): self.pick_trump('S') def pick_clubs(self): self.pick_trump('C') def pick_diamonds(self): self.pick_trump('D') def pick_trump(self,suit): self.trump_picked = True print('Trump Changed to {}'.format(suit)) self.model.set_trump(suit) print('---') self.view.color_trump_buttons(trump=suit) self.view.clear_advice() self.view.color_advice_buttons() self._add_comm(self.last_comm) self._add_hand(self.last_hand) if self.last_play_func: self.last_play_func()
def __init__(self): Application.__init__(self) self.pdf_type = FileType(name="PDF Document", suffix="pdf", #mac_creator = "BLBE", mac_type = "BLOB", # These are optional ) self.file_type = self.pdf_type
def printComments(comments): for user, comment in comments: print(user + " says...") print(comment) printLine() gameID = input("Enter your game id: ") comments = getExtracted(gameID) printComments(comments) noOfComments = len(comments) print("\n\n\n" + str(noOfComments) + " comments in total.") time = int(input("How often should I check for more (seconds)? ")) Application() while (True): print(".", end="", flush=True) sleep(time) comments = getExtracted(gameID) if (len(comments) > noOfComments): numberOfNew = noOfComments - len(comments) new = comments[numberOfNew:] alert('note', 'New Comment!') print("\n****** NEW COMMENTS ******") printLine() printComments(new) noOfComments = len(comments)
def main(): root = tkinter.Tk() app = Application(master=root) app.mainloop()
def __init__(self): Application.__init__(self)
f2 = StringVar() Sha256f1 = StringVar() Sha256f2 = StringVar() MD5f1 = StringVar() MD5f2 = StringVar() Sha1f1 = StringVar() Sha1f2 = StringVar() checksum = Frame(root, width=1350, height=1000, relief='raise', bd=14) checksum.pack(side=LEFT, expand=True, fill=None) password_gen = Frame(root, width=100, height=100, relief='raise', bd=14) password_gen.pack(side=RIGHT, expand=True, fill='y') stego = Frame(root, width=1350, height=1000, relief='raise', bd=14) stego.pack(side=RIGHT, expand=True, fill='y') app = Application(stego) ckslbl = Label(checksum, text='CHECKSUM VERIFER').pack(side=TOP) stegolbl = Label(stego, text='STEGANOGRAPHY MINI-TOOLKIT').pack(side=TOP) password_genlbl = Label(password_gen, text="SECURE PASSWORD GENERATOR").pack(side=TOP) def hash_bytestr_iter(bytesiter, hasher, ashexstr=True): for block in bytesiter: hasher.update(block) return (hasher.hexdigest() if ashexstr else hasher.digest()) def file_as_blockiter(afile, blocksize=65536): with afile:
def __init__(self): Application.__init__(self) self.blob_type = FileType(name = "Blob Document", suffix = "blob") self.file_type = self.blob_type self.blob_cursor = Cursor("C:\Users\m149947\Downloads\sample.tif")
def __init__(self): Application.__init__(self, title = "Log Analysis Tool") print >>sys.stderr, "app init'd" self.window = Window(size = (1200, 750), title = "Log Analysis Tool") print >>sys.stderr, "made window" # Create db cursor db = get_conn(dbname = 'reduced_log') self.cur = db.cursor() print >>sys.stderr, "made db cursor" self.current_table_suffix = None # Load the dummy image for now self.image = GraphView(size = (640, 460), position = (10, 10)) self.graph_panel = Frame() self.graph_panel.add(self.image) print >>sys.stderr, "loaded dummy image" # Declare other image lists self.full_ = None self.peruser_alltime_ = None self.peruser_divided_total_ = None self.peruser_divided_ = None # Create the display selection radio self.display_select_radiogroup = RadioGroup(action = self.change_images) height, startx = 495, 20 sp = 10 r1 = RadioButton("All users", group = self.display_select_radiogroup, value = 'all_users') r2 = RadioButton("Per user, query type", group = self.display_select_radiogroup, value = 'peruser_querytype') r3 = RadioButton("Per user, time", group = self.display_select_radiogroup, value = 'peruser_time') r4 = RadioButton("Per user, query type and time", group = self.display_select_radiogroup, value = 'peruser_querytype_time') self.graph_panel.place(r1, top = self.image + 10, left = sp) self.graph_panel.place(r2, top = self.image + 10, left = r1 + sp) self.graph_panel.place(r3, top = self.image + 10, left = r2 + sp) self.graph_panel.place(r4, top = self.image + 10, left = r3 + sp) self.window.place(self.graph_panel, top=0, left=0) self.display_select_radiogroup.value = 'all_users' # Create the top queries textbox self.topqueries = TopqueryPanel(size = (500, 460), extent = (500, 1000)) self.topqueries.panels = [[TopqueryLabel("This is a placeholder until you select a filter", ["This is where", "the values", "will go"])]] self.window.place(self.topqueries, top=10, left=680) topqueries_next_button = Button("Next", action = self.topqueries.next) topqueries_prev_button = Button("Prev", action = self.topqueries.prev) self.window.place(topqueries_next_button, left = 930, top = top - 50) self.window.place(topqueries_prev_button, left = 830, top = top - 50) print >>sys.stderr, "made top queries text box" # Declare the filter and last updated filter pointers self.fil = None self.last_used_fil = None # # ************************* # FILTER PANEL # ************************* # # **CREATE DATE PANEL** field_width = 140 self.date_panel = Frame() self.begin_date_field = TextField(size = (field_width, 30), position = (0, 5), text = DEFAULT_BEGIN_DATE_TEXT) self.end_date_field = TextField(size = (field_width, 30), position = (0, 35), text = DEFAULT_END_DATE_TEXT) self.date_panel.size = (field_width, 0) # Time division radios self.time_division_radiogroup = RadioGroup() left, right = 5, 70 row1, rowspace = 95, 25 group_by_label = Label("Group by:", position = (5, 70)) hour = RadioButton("Hour", position = (left, row1), group = self.time_division_radiogroup, value = 'hour') day = RadioButton("Day", position = (right, row1), group = self.time_division_radiogroup, value = 'day') week = RadioButton('Week', position = (left, row1 + rowspace), group = self.time_division_radiogroup, value = 'week', enabled = False) #TODO: implement 'week' in the gnuplot function month = RadioButton("Month", position = (right, row1 + rowspace), group = self.time_division_radiogroup, value = 'month') year = RadioButton("Year", position = (left, row1 + 2*rowspace), group = self.time_division_radiogroup, value = 'year') self.time_division_radiogroup.value = 'day' self.last_grouped_by = None # Add all to date panel self.date_panel.add([self.begin_date_field, self.end_date_field]) self.date_panel.add([group_by_label, hour, day, week, month, year]) self.window.place(self.date_panel, top=top, left=10) print >>sys.stderr, "made date panel" # **CREATE QUERY TYPE FILTER CHECKBOXES** x_pos = 0 y_pos = 0 y_spacing = 20 self.query_type_checkboxes = {} for qtype in querytypes: # underscores don't display properly, need an extra space after self.query_type_checkboxes[qtype] = CheckBox(qtype.replace('_', '_ '), position = (x_pos, y_pos), value = True) y_pos += y_spacing # Add the query type checkboxes and buttons to a Frame self.query_type_panel = Frame() maxw = 0 for cbox in self.query_type_checkboxes.values(): self.query_type_panel.add(cbox) maxw = max(cbox.size[0], maxw) self.query_type_panel.size = (maxw, 0) # Create all/none/invert buttons for query types buttonsize = (55, 25) self.query_type_panel.add(Button("All", action = (self.select_all, 'query_type'), size = buttonsize, position = (20, y_pos))) y_pos += 25 self.query_type_panel.add(Button("None", action = (self.deselect_all, 'query_type'), size = buttonsize, position = (20, y_pos))) y_pos += 25 self.query_type_panel.add(Button("Invert", action = (self.invert_all, 'query_type'), size = buttonsize, position = (20, y_pos))) # Add query_type_panel to the window self.window.place(self.query_type_panel, top = top, left=self.date_panel + horiz_sp) print >>sys.stderr, "made query type cboxes" # **CREATE USER AND SERVER CHECKBOX LISTS** self.user_panel = None self.server_panel = None self.create_checkbox_lists(initial=True) self.cur.execute("SELECT user, userid FROM users") self.userids = dict(self.cur.fetchall()) self.cur.execute("SELECT server, serverid FROM servers") self.serverids = dict(self.cur.fetchall()) print >>sys.stderr, "made user, server cboxes" # **CREATE QUERY SEARCH STRING PANEL** num_search_strings = 5 spacing = 30 field_width = 250 self.search_string_panel = Frame() self.search_string_panel.size = (field_width, 0) self.search_string_fields = [TextField(size = (field_width, 30), position = (0, spacing * i), text = "Query Search String {0}".format(i + 1)) for i in range(num_search_strings)] self.search_string_panel.add(self.search_string_fields) self.any_all_radiogroup = RadioGroup() any_string_radio = RadioButton("Any", position = (40, 10 + spacing * \ num_search_strings), group = self.any_all_radiogroup, value = 'any') all_strings_radio = RadioButton("All", position = (130, 10 + spacing * \ num_search_strings), group = self.any_all_radiogroup, value = 'all') no_string_radio = RadioButton("None", position = (40, 30 + spacing * \ num_search_strings), group = self.any_all_radiogroup, value = 'none') not_all_string_radio = RadioButton("Not All", position = (130, 30 + spacing * \ num_search_strings), group = self.any_all_radiogroup, value = 'not all') self.any_all_radiogroup.value = 'any' self.search_string_panel.add(any_string_radio) self.search_string_panel.add(all_strings_radio) self.search_string_panel.add(no_string_radio) self.search_string_panel.add(not_all_string_radio) self.window.place(self.search_string_panel, top = top, left = self.server_panel + 10) print >>sys.stderr, "made search string panel" # SELECT ALL/NONE, INVERT USERS # TODO: create user, server panels? atm only the cboxes are in # a ScrollableView buttonsize = (55, 25) invertbuttonsize = (60, 25) userstart = 295 serverstart = 565 self.window.place(Button("All", action = (self.select_all, 'user'), size = buttonsize), top = top + 155, left = userstart) self.window.place(Button("None", action = (self.deselect_all, 'user'), size = buttonsize), top = top + 155, left = userstart + 55 + 5) self.window.place(Button("Invert", action = (self.invert_all, 'user'), size = invertbuttonsize), top = top + 155, left = userstart + 55 + 5 + 55 + 5) # user search string textbox # TODO: the action is always one keystroke behind the text field. # This is a PyGUI 'bug',but it may only happen on windows (not sure # how the X server works). # See http://mail.python.org/pipermail/pygui/2010-November/000102.html self.user_search_string = ResponsiveTextField(emptyaction = None, action = (self.select_all_matching, 'user'), size = (180, 30), text = DEFAULT_USER_SEARCH_STRING) self.window.place(self.user_search_string, top = top + 155 + 25 + 5, left = userstart) # SELECT ALL/NONE, INVERT SERVERS self.window.place(Button("All", action = (self.select_all, 'server'), size = buttonsize), top = top + 155, left = serverstart) self.window.place(Button("None", action = (self.deselect_all, 'server'), size = buttonsize), top = top + 155, left = serverstart + 55 + 5) self.window.place(Button("Invert", action = (self.invert_all, 'server'), size = invertbuttonsize), top = top + 155, left = serverstart + 55 + 5 + 55 + 5) # server search string textbox self.server_search_string = ResponsiveTextField(emptyaction = None, action = (self.select_all_matching, 'server'), size = (180, 30), text = DEFAULT_SERVER_SEARCH_STRING) self.window.place(self.server_search_string, top = top + 155 + 25 + 5, left=serverstart) self.window.show() # **CREATE BUTTONS** self.negate = CheckBox("Negate Filter", position=(0, 0), value=False) self.refresh_button = Button("Refresh", position = (0, 25), action=self.refresh) self.update_button = Button("Update", position = (0, 60), action = self.update) # Add buttons to a panel self.button_panel = Frame() self.button_panel.add([self.negate, self.refresh_button, self.update_button]) self.window.place(self.button_panel, top = top, left=self.search_string_panel + horiz_sp) print >>sys.stderr, "made button panel"
from GUI import Application # Define the shared data between the processes msgQ = Queue(0) data_array = Array(ctypes.c_ubyte, 50) if __name__ == '__main__': # Create the root window root = Tk() root.title('KSP Controller') root.configure(background="black") root.geometry('{0}x{1}'.format(c_screen_size_x, c_screen_size_y) + c_screen_pos) # Instatiate the GUI app = Application(root, data_array, msgQ) stage_prev = None frame_time = time() # Loop the window, calling an update then refreshing the window while 1: if time() > frame_time + 0.250: frame_time = time() if app.game_connected == False or app.vessel_connected == False: app.connect(msgQ) elif app.conn.krpc.current_game_scene == app.conn.krpc.current_game_scene.flight: if app.vessel.control.current_stage is not stage_prev: app.update_streams() stage_prev = app.vessel.control.current_stage
def __init__(self): Application.__init__(self) self.make_window()
def __init__( self ): """This is the constructor for the object.""" #call the parent constructor Application.__init__( self )
from GUI import Application import tkinter as tk if __name__ == '__main__': app = Application() app.root.mainloop()
def prev(self): self.currently_displayed -= 1 self.invalidate() def mouse_down(self, event): for comp in self.contents: if geo.pt_in_rect(event.position, comp.bounds): comp.mouse_down(event) return def get_header(self, user): return "TOP QUERIES FOR {0}\ncount | query\n".format(user) + '=' * 100 if __name__ == '__main__': a = Application() a.window = Window(size = (500, 500)) testpanel = TopqueryPanel(size = (300, 300), extent = (1000, 1000)) testpanel.panels.append([TopqueryLabel("this is the query", ["val1 || val2", "val3 || val4"], size = (300, testpanel.font.line_height))]) testpanel.panels[0].append(TopqueryLabel("this is another query", ["val1 || val2", "val3 || val4"], size = (300, testpanel.font.line_height))) testpanel.panels.append([TopqueryLabel("this is another panel", ["val1 || val2", "val3 || val4"], size = (300, testpanel.font.line_height))])
def __init__(self): Application.__init__(self) self.file_type = FileType(name = "Blob Document", suffix = "blob")
from CreateObjects import CreateObjects import tkinter as tk from GUI import Application # create random data for stuff createObjects = CreateObjects() # initial tkinter root = tk.Tk() # begin gui app = Application(createObjects.createRoom(1, 1, 1, 2, 1, 'Living Room'), master=root) app.mainloop()
from GUI import Application # Define the shared data between the processes msgQ = Queue(0) data_array = Array(ctypes.c_ubyte, 50) if __name__ == '__main__': # Create the root window root = Tk() root.title('KSP Controller') root.configure(background = "black") root.geometry('{0}x{1}'.format(c_screen_size_x,c_screen_size_y) + c_screen_pos) # Instatiate the GUI app = Application(root, data_array, msgQ) stage_prev = None frame_time = time() # Loop the window, calling an update then refreshing the window while 1: if time() > frame_time + 0.250: frame_time = time() if app.game_connected == False or app.vessel_connected == False: app.connect(msgQ) elif app.conn.krpc.current_game_scene == app.conn.krpc.current_game_scene.flight: if app.vessel.control.current_stage is not stage_prev: app.update_streams() stage_prev = app.vessel.control.current_stage
#!/usr/bin/env python from GUI import Application if __name__ == '__main__': app = Application() app.master.resizable(width=False, height=False) app.master.title("Sudoku Solver") app.mainloop()