def createApp(): window = tkinter.Tk() setAppProperties(window) global left_frame, right_frame, search, list set_theme("dark") left_frame = Frame(window, dict(bg=GUI["colors"]["primary"], width=300, height=GUI["dimensions"]["height"]), "left", "y") right_frame = Frame(window, dict(bg=GUI["colors"]["secondary"], width=GUI["dimensions"]["width"] - 300, height=GUI["dimensions"]["height"]), "right", "y") search = Search(left_frame, "Search", dict(width = 20, font=('Inter', 12)), dict(x=10, y=10), dict(x=219, y=10), function = searchPassword) list = List(left_frame, getPasswords(), dict(fg="#ffffff", bg="#1c1c1c", highlightbackground='white', width = 25, height = 22, font=('Inter 15')), dict(x=10, y=50)) list.bind("<<ListboxSelect>>", select) showPasswordInformation() window.mainloop()
def main(): ball_speed = 3 paddle_speed = 5 #Starting pygame pygame.init() #Setting screen size = width, height = 1360, 768 screen = pygame.display.set_mode(size) #Making the frame frame = Frame(dimensions=size) #Making the left paddle and setting its speed lpad = Paddle(pos=[0, height // 2], up=pygame.K_w, dwn=pygame.K_s, speed=paddle_speed) #Making the right paddle and setting its speed rpad = Paddle(pos=[width - 20, height // 2], speed=paddle_speed) #Making the ball and setting its speed ball = Ball(pos=[width // 2, height // 2], speed=[ball_speed, ball_speed]) #Making the scoreboard scoreboard = Scoreboard((0, 0), pos=[width // 2, 0]) #Starting game loop game_loop(screen, frame, lpad, rpad, ball, scoreboard) #Quitting the game pygame.quit()
def Startup(self): # Importing takes sometime, therefore it will be done # while splash is being shown from gui.frame import Frame from control import Controller from project import Project self.main = Frame(None) self.control = Controller(self.main) self.fc = wx.FutureCall(1, self.ShowMain) wx.FutureCall(1, parse_comand_line) # Check for updates from threading import Thread p = Thread(target=utils.UpdateCheck, args=()) p.start()
def __init__(self, simulator): # bind the simulator self.simulator = simulator # initialize frame self.current_frame = Frame() # initialize camera parameters self.view_width_pixels = DEFAULT_VIEW_PIX_W self.view_height_pixels = DEFAULT_VIEW_PIX_H self.pixels_per_meter = DEFAULT_ZOOM # initialize the window self.window = Gtk.Window() self.window.set_title('Sobot Rimulator') self.window.set_resizable(False) self.window.connect('delete_event', self.on_delete) # initialize the drawing_area self.drawing_area = Gtk.DrawingArea() self.drawing_area.set_size_request(self.view_width_pixels, self.view_height_pixels) self.drawing_area.connect('draw', self.on_expose) # initialize the painter self.painter = Painter(self.pixels_per_meter) # == initialize the buttons # build the play button self.button_play = Gtk.Button('Play') play_image = Gtk.Image() play_image.set_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON) self.button_play.set_image(play_image) self.button_play.set_image_position(Gtk.PositionType.LEFT) self.button_play.connect('clicked', self.on_play) # build the stop button self.button_stop = Gtk.Button('Stop') stop_image = Gtk.Image() stop_image.set_from_stock(Gtk.STOCK_MEDIA_STOP, Gtk.IconSize.BUTTON) self.button_stop.set_image(stop_image) self.button_stop.set_image_position(Gtk.PositionType.LEFT) self.button_stop.connect('clicked', self.on_stop) # build the step button self.button_step = Gtk.Button('Step') step_image = Gtk.Image() step_image.set_from_stock(Gtk.STOCK_MEDIA_NEXT, Gtk.IconSize.BUTTON) self.button_step.set_image(step_image) self.button_step.set_image_position(Gtk.PositionType.LEFT) self.button_step.connect('clicked', self.on_step) # build the reset button self.button_reset = Gtk.Button('Reset') reset_image = Gtk.Image() reset_image.set_from_stock(Gtk.STOCK_MEDIA_REWIND, Gtk.IconSize.BUTTON) self.button_reset.set_image(reset_image) self.button_reset.set_image_position(Gtk.PositionType.LEFT) self.button_reset.connect('clicked', self.on_reset) # build the save map button self.button_save_map = Gtk.Button('Save Map') save_map_image = Gtk.Image() save_map_image.set_from_stock(Gtk.STOCK_SAVE, Gtk.IconSize.BUTTON) self.button_save_map.set_image(save_map_image) self.button_save_map.set_image_position(Gtk.PositionType.LEFT) self.button_save_map.connect('clicked', self.on_save_map) # build the load map button self.button_load_map = Gtk.Button('Load Map') load_map_image = Gtk.Image() load_map_image.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON) self.button_load_map.set_image(load_map_image) self.button_load_map.set_image_position(Gtk.PositionType.LEFT) self.button_load_map.connect('clicked', self.on_load_map) # build the random map buttons self.button_random_map = Gtk.Button('Random Map') random_map_image = Gtk.Image() random_map_image.set_from_stock(Gtk.STOCK_REFRESH, Gtk.IconSize.BUTTON) self.button_random_map.set_image(random_map_image) self.button_random_map.set_image_position(Gtk.PositionType.LEFT) self.button_random_map.connect('clicked', self.on_random_map) # build the show-invisibles toggle button self.show_invisibles = False # controls whether invisible world elements are displayed self.button_show_invisibles = Gtk.Button() self._decorate_show_invisibles_button_inactive() self.button_show_invisibles.set_image_position(Gtk.PositionType.LEFT) self.button_show_invisibles.connect('clicked', self.on_show_invisibles) # == lay out the window # pack the simulation control buttons sim_controls_box = Gtk.HBox(spacing=5) sim_controls_box.pack_start(self.button_play, False, False, 0) sim_controls_box.pack_start(self.button_stop, False, False, 0) sim_controls_box.pack_start(self.button_step, False, False, 0) sim_controls_box.pack_start(self.button_reset, False, False, 0) # pack the map control buttons map_controls_box = Gtk.HBox(spacing=5) map_controls_box.pack_start(self.button_save_map, False, False, 0) map_controls_box.pack_start(self.button_load_map, False, False, 0) map_controls_box.pack_start(self.button_random_map, False, False, 0) # pack the invisibles button invisibles_button_box = Gtk.HBox() invisibles_button_box.pack_start(self.button_show_invisibles, False, False, 0) # align the controls sim_controls_alignment = Gtk.Alignment(xalign=0.5, yalign=0.5, xscale=0, yscale=0) map_controls_alignment = Gtk.Alignment(xalign=0.5, yalign=0.5, xscale=0, yscale=0) invisibles_button_alignment = Gtk.Alignment(xalign=0.5, yalign=0.5, xscale=0, yscale=0) sim_controls_alignment.add(sim_controls_box) map_controls_alignment.add(map_controls_box) invisibles_button_alignment.add(invisibles_button_box) # create the alert box self.alert_box = Gtk.Label() # lay out the simulation view and all of the controls layout_box = Gtk.VBox() layout_box.pack_start(self.drawing_area, False, False, 0) layout_box.pack_start(self.alert_box, False, False, 5) layout_box.pack_start(sim_controls_alignment, False, False, 5) layout_box.pack_start(map_controls_alignment, False, False, 5) layout_box.pack_start(invisibles_button_alignment, False, False, 5) # apply the layout self.window.add(layout_box) # show the simulator window self.window.show_all()
def new_frame(self): self.current_frame = Frame()
def __init__(self, handle): activity.Activity.__init__(self, handle) # TODO - clean - install gettext os.chdir(Globals.pwd) # required for i18n.py to work #gettext.install('JokeMachine', './po', unicode=True) #presLan_af = gettext.translation("JokeMachine", os.path.join(Globals.pwd, 'po'), languages=['af']) #presLan_af.install() #locale.setlocale(locale.LC_ALL, 'af') # customize theme gtkrc = os.path.join(Globals.pwd, 'resources/gtkrc') if os.path.exists(gtkrc): logging.debug("Loading resources from %s" % gtkrc) gtk.rc_add_default_file(gtkrc) settings = gtk.settings_get_default() #gtk.rc_reset_styles(settings) gtk.rc_reparse_all_for_settings(settings, True) logging.debug("Loading resources DONE") Globals.set_activity_instance(self) logging.debug("Starting the Joke Machine activity") # toolbox self.__toolbox = activity.ActivityToolbox(self) self.set_toolbox(self.__toolbox) # main activity frame self.__activity_frame = Frame() vbox = gtk.VBox() vbox.pack_start(self.__activity_frame) vbox.show() self.set_canvas(vbox) self.show_all() # Initialize mesh ########################################################## # init Presence Service self.__presence_service = presenceservice.get_instance() try: name, path = self.__presence_service.get_preferred_connection() self.__telepathy_connection = telepathy.client.Connection( name, path) self.__telepathy_initiating = None except TypeError: logging.debug('Presence service offline') # Buddy object for you owner = self.__presence_service.get_owner() Globals.set_owner(owner) self.__session = None # JokeMachineSession self.connect('shared', self.__do_activity_shared) # Check if we're joining another instance self.__is_initiator = True if self._shared_activity is not None: self.alert( _('Joke Machine'), _('Please wait a moment for your buddy\'s Jokebooks to show up' )) self.__is_initiator = False logging.debug('shared: %s' % self._shared_activity.props.joined) # We are joining the activity logging.debug('Joined activity') self.connect('joined', self.__do_activity_joined) self._shared_activity.connect('buddy-joined', self.__do_buddy_joined) self._shared_activity.connect('buddy-left', self.__do_buddy_left) if self.get_shared(): # We've already joined self.__do_activity_joined() else: logging.debug('Created activity') # ########################################################################## # set default startup page if we're the initiator if self.is_initiator: self.set_page(pages.choose.Choose)