示例#1
0
 def __init__(self):
     self._root = Tk()
     self._window_title = 'uatu-0.0.0'
     self._window_width = 500
     self._window_height = 300
     self._window_position = 200
     self._run_conditions = 0
     self._tk_bb_image_1 = PhotoImage(file='../images/bb-3.png')
     self._tk_bb_image_2 = PhotoImage(file='../images/bb-2.png')
     self._loaded_model_text = None  # Label(root, text='No model loaded')
     self._loaded_test_text = None  # Label(root, text='No test loaded')
     self._bb_image_left = None  # Label(root, image=tk_bb_image)
     self._bb_image_right = None  # Label(root, image=tk_bb_image)
     self._run_button = None  # Button(root, text='Run', state='disabled')
     self._step_button = None  # Button(root, text='Step', state='disabled')
     self._reset_button = None  # Button(root, text='Stop', state='disabled')
     self._certainty_text = None  # Label(root, text='1.00')
     self._prediction_text = None  # Label(root, text='MATCH')
     self._is_model_loaded = False
     self._is_test_loaded = False
     self._load_model_button = None  # Button(gv.root, text='Load Model', command=lambda: load_model_button(gv)).grid(row=0, column=2)
     self._load_test_button = None  # Button(gv.root, text='Load Test', command=lambda: load_test_button(gv)).grid(row=2, column=2)
     self._model = None
     self._test = None
     self._step_position = 0
     self._max_position = 0
     self._stop_button = None
     self._stop_press = False
     self._pred = 0
     self._truth_text = None
     self._all_truth = None
     self._number_of_data = 200
     self._run_speed = 50
示例#2
0
    def __init__(self, parent):
        """The View component of the Hut Game.

        This class represents the view component of a MVC architecture.
        It defines and sets up graphical user interface. In this example,
        the View has no knowledge of the Controller or the model. However,
        the Controller sets up the necessary callback functions that are
        invoked when various events are triggered.

        :param parent: The parent tkinter widget.In this example it is the
            instance of Tk class (called mainwin)
        :ivar int hut_width: The width of the application window in pixels.
        :ivar int hut_height: The height of the application window in pixels
        :ivar PhotoImage village_image: Background image for the app
        :ivar PhotoImage hut_image: The hut image for the radio buttons.
        :ivar container: The main widget serving as a parent for others.
            In this example it is just the main Tk instance passed as
        :ivar str result: The string to declare the result via a messagebox.
        """
        self.village_image = PhotoImage(file="Jungle_small.gif")
        self.hut_image = PhotoImage(file="Hut_small.gif")
        self.container = parent
        # ------------------------------------------------------------------
        # Important: Set the hut_width to about 70 pixels if the radio
        # button is configured with "indicatoron=0" option (i.e. without the
        # radio button indicator
        # ------------------------------------------------------------------
        self.hut_width = 40
        self.hut_height = 56

        self.radio_btn_pressed = None
示例#3
0
    def __init__(self, master=None, test=False):
        Frame.__init__(self, master)
        _ver = __version__.split()
        self.master.title(" " * 5 +
                          "{}    {}".format(_ver[0], _ver[2]))  #.master

        self.pack()  # ... why I'm packing here?? coords?
        self.test = test

        # images storaging
        dir_path = dirname(realpath(__file__))
        self.img = dict()
        self.img['logo'] = PhotoImage(file=dir_path + "/img/logo.ppm")
        self.img['help'] = PhotoImage(file=dir_path + "/img/help.ppm")
        self.img['file'] = PhotoImage(file=dir_path + "/img/file.ppm")
        self.img['gear'] = PhotoImage(file=dir_path + "/img/gear.ppm")

        # body init
        self.prevailing_body = 0
        self.body = None
        self.MAINVERTEX = [0, 0, 0, 0, 0, 0]

        # Conversion gathered data container
        self._convert_ = {'setup': [], 'solvation': []}
        self._convertdata_ = None
        # Script part
        self._script_ = {'mainpage': [], 'advanced': [], 'restrain': []}

        self.createmainPennon()
    def __init__(self):
        self._root = Tk()
        self._window_title = 'deepimpression 2.0'
        self._window_width = 500
        self._window_height = 500 + 300
        self._window_position = 200

        self._camera_image = PhotoImage(file='media/eye.png')
        self._camera = None

        self._trait_image_all = PhotoImage(file=trait_image)
        self._trait_all = None

        self._run_button = None
        self._keep_going = False

        self._model = None

        self._series_o = [0.5] * series_length
        self._series_c = [0.5] * series_length
        self._series_e = [0.5] * series_length
        self._series_a = [0.5] * series_length
        self._series_s = [0.5] * series_length

        self._label_o = None
        self._label_c = None
        self._label_e = None
        self._label_a = None
        self._label_s = None
示例#5
0
def game(name):
    """
    Quand la boutton est actionné :
        - Met la case en True
        - Met les points suivant le joueur (les points permettent de définir le gagnant)
        - Met la case en croix ou en cercle selon le joueur
    """
    cross = PhotoImage(file='./Image/croix.png')
    circle = PhotoImage(file='./Image/cercle.png')
    #Définition du joueur qui joue
    global player
    print(player)
    player += 1
    player %= 2

    #Pour chaque clef du dictionnaire
    for nameCase in case.keys():
        if str(nameCase) == name:
            substitute = case[name]
            if substitute[0] == True:  #Si case déjà prise
                player += 1
                player %= 2  #Revient au joueur initial
                break
            else:
                substitute[0] = True  #Case prise
                if player == 0:
                    substitute[1] = 1  #J2 points
                    buttons[substitute[4] - 1].config(
                        image=cross)  #Met la croix
                if player == 1:
                    substitute[1] = 10  #J1 points
                    buttons[substitute[4] - 1].config(
                        image=circle)  #Met le cercle
                case[name] = substitute
                files()
示例#6
0
 def __init__(self, parent, controller):
     Frame.__init__(self, parent)
     self.parent = parent
     self.controller = controller
     self.controller.bindStatic(self)
     self.battery = True
     tmpDate = list(localtime()[0:3])
     self.curDate = [tmpDate[1], tmpDate[2], int(str(tmpDate[0])[3:])]
     self.dateTag = None
     self.curTime = list(localtime()[3:6])
     self.timeTag = None
     self.curAlarm = [
      12, 0, 0]
     self.alarmTag = None
     self.curChrono = [
      0, 0, 0]
     self.chronoTag = None
     self.noteImage = PhotoImage(file='./noteSmall.gif')
     self.watchImage = PhotoImage(file='./watch.gif')
     self.alarmNoteTag = None
     self.curSelectionInfo = None
     self.curSelection = ['hours', 'minutes', 'seconds',
      'months', 'days', 'years']
     self.curSelectionIndex = 0
     self.lastPressed = ''
     self.createWidgets()
     parent.protocol('WM_DELETE_WINDOW', self.controller.window_close)
     self.drawTime()
     self.drawDate()
     return
示例#7
0
    def __init__(self, parent):
        """A game where the player selects a hut to rest.

        The program initially puts 'enemy' or a 'friend' inside each hut. Some
        huts could also be left 'unoccupied'. You are asked to select a hut.
        You win if the hut occupant is either a 'friend' or if the hut is not
        occupied.

        :param parent: the parent tkinter widget
        :ivar list huts: list to store occupant types (as strings)
        :ivar int hut_width: the width of the application window in pixels
        :ivar int hut_height: the height of the application window in pixels
        :ivar PhotoImage village_image: background image for the app
        :ivar PhotoImage hut_image: the hut image for the radio buttons
        :ivar Tk container: the main widget serving as a parent for others. In
            this example it is just the main Tk instance.
        :ivar str result: the string to declare the result via a messagebox.
        """
        self.village_image = PhotoImage(file="jungle_small.gif")
        self.hut_image = PhotoImage(file="hut_small.gif")
        self.hut_width = 40
        self.hut_height = 56
        self.container = parent
        self.huts = []
        self.result = ""
        self.occupy_huts()
        self.setup()
示例#8
0
def reset(gv):
    gv.run_button.config(text='Run', state='disabled')
    gv.loaded_model_text.config(text='No model loaded')
    gv.is_model_loaded = False
    gv.loaded_test_text.config(text='No data loaded')
    gv.is_test_loaded = False
    gv.step_button.config(state='disabled')
    gv.load_model_button.config(state='active')
    gv.load_test_button.config(state='active')

    # set images back to original
    gv.tk_bb_image_1 = PhotoImage(file='../images/bb-3.png')
    gv.bb_image_left.config(image=gv.tk_bb_image_1)

    gv.tk_bb_image_2 = PhotoImage(file='../images/bb-2.png')
    gv.bb_image_right.config(image=gv.tk_bb_image_2)

    # set step_position back to zero
    gv.step_position = 0

    # set max_position back to zero
    gv.max_position = 0

    gv.certainty_text.config(text='1.00')
    gv.prediction_text.config(text='Predict:    Match', fg='black')

    gv.truth_text.config(text='Truth:   Match', fg='black')

    gv.reset_button.config(state='disabled')
    print('reset')
示例#9
0
 def draw_one_frame(self, picNbr=0):
     giflist = []
     giflist.append(PhotoImage(file='loadingdot1.gif'))
     giflist.append(PhotoImage(file='loadingdot2.gif'))
     giflist.append(PhotoImage(file='loadingdot3.gif'))
     #picNum = picNbr % (len(giflist))
     gif = giflist[picNbr]
     self.canvas.create_image(gif.width() // 2,
                              gif.height() // 2,
                              image=gif)
示例#10
0
 def setRoomImage(self):
     if (Game.currentRoom == None):
         # if dead, set the skull image
         Game.img = PhotoImage(file="skull.gif")
     else:
         # otherwise grab the image for the current room
         Game.img = PhotoImage(file=Game.currentRoom.image)
     # display the image on the left of the GUI
     Game.image.config(image=Game.img)
     Game.image.image = Game.img
示例#11
0
    def constructWindow(self):
        self.frm_home = Tk()
        self.frm_home.geometry('300x370+0+0')
        self.frm_home.title('Welcome')
        self.frm_home.resizable(False, False)

        Label(self.frm_home, text="Your Bank Name",
              font=("Courier", 20)).pack()
        Label(self.frm_home, text="------------------",
              font=("Courier", 20)).pack()
        #
        Label(self.frm_home, text="Enter Account #",
              font=("Courier", 15)).pack()
        self.txt_accountNumber = Entry(self.frm_home,
                                       justify='center',
                                       font=("Courier", 15))
        self.txt_accountNumber.pack(fill=X, padx=30)
        #
        self.img_begin = PhotoImage(file="img_begin.gif")
        self.btn_begin = Button(self.frm_home,
                                text="Begin Transaction",
                                font=("Courier", 10),
                                bg='#FFFFFF',
                                image=self.img_begin,
                                compound='left',
                                command=lambda: self.onBeginTransaction())
        self.btn_begin.pack(fill=X, padx=10, pady=5)
        #
        Label(self.frm_home, text="------- OR -------",
              font=("Courier", 20)).pack()
        #
        self.img_create = PhotoImage(file="img_add_account.gif")
        self.btn_create = Button(self.frm_home,
                                 text="Create Account",
                                 anchor='w',
                                 font=("Courier", 10),
                                 bg='#FFFFFF',
                                 image=self.img_create,
                                 compound='left',
                                 command=lambda: self.onCreate())
        self.btn_create.pack(fill=X, padx=10, pady=5)
        #
        self.img_exit = PhotoImage(file="img_exit.gif")
        self.btn_exit = Button(self.frm_home,
                               text="Exit",
                               anchor='w',
                               font=("Courier", 10),
                               bg='#FFFFFF',
                               image=self.img_exit,
                               compound='left',
                               command=lambda: self.onExit())
        self.btn_exit.pack(fill=X, padx=10, pady=5)

        self.frm_home.mainloop()
        pass  # end
示例#12
0
    def __init__(self, parent):
        self.imagen_fondo = PhotoImage(file="Jungle_small_2.gif")
        self.imagen_choza = PhotoImage(file="Hut_small_2.gif")

        self.ancho_choza = 60
        self.alto_choza = 140
        self.container = parent

        self.Chozas = []
        self.result = ""

        self.ocupar_chozas()

        self.setup()
示例#13
0
 def updateButtons(self):
     self.pic1 = PhotoImage(file="1.gif").subsample(6, 6)
     self.pic2 = PhotoImage(file="2.gif").subsample(6, 6)
     self.pic3 = PhotoImage(file="3.gif").subsample(6, 6)
     for r in range(envVar.gridSize):
         for c in range(envVar.gridSize):
             if envVar.gridOriginal[r][c] == 0:
                 self.buttons[envVar.gridSize * r +
                              c].config(image=self.pic1)
             elif envVar.gridOriginal[r][c] == 1:
                 self.buttons[envVar.gridSize * r +
                              c].config(image=self.pic2)
             elif envVar.gridOriginal[r][c] == 2:
                 self.buttons[envVar.gridSize * r +
                              c].config(image=self.pic3)
示例#14
0
	def __gui_create(self):
		self.root=Tk()
		self.root.title('ClickNEOBUX')
		w=self.root.winfo_screenwidth()-180
		h=self.root.winfo_screenheight()-50
		self.root.geometry('180x80+'+str(w)+'+'+str(h))
		self.root.resizable(False,False)
		self.root.protocol('WM_DELETE_WINDOW',self.__gui_exit)
		try:
			self.root.call('wm','iconphoto',self.root._w,PhotoImage(file='data/neobux.png'))
		except Exception:
			print 'Error loading icon'
	
		self.text_btn=StringVar()
		self.text_btn.set('Start')
		Button(self.root,textvariable=self.text_btn,command=self.__gui_click_btn).place(x=50,y=10,height=30,width=80)
	
		self.text_lb=StringVar()
		self.text_lb.set('Pausing ...')
		Label(self.root,textvariable=self.text_lb).place(x=0,y=50,width=180,height=30)
		
		#self.root.after(0,self.__check_status)
		
		self.root.mainloop()
		print 'Exit GUI'
示例#15
0
def gridd():
    """
    Crée la grille avec l'interface tkinter et crée les boutons
    """
    global window
    global intermediateVariable
    global player
    window.geometry("680x680")  #Dimension de l'interface
    #default = PhotoImage(file='./Image/default.png')

    #Boutons:
    #Le x=0 est le bord gauche de la fenetre
    #Le y=0 est le bord haut de la fenetre
    #La position est la position du coin en haut à gauche du bouton

    # Création des boutons
    intermediateVariable = 0
    cross = PhotoImage(file='./Image/croix.png')
    for nameCase in case.keys():
        newbutton = Button(window,
                           image=cross,
                           name=str(nameCase).lower(),
                           state="active")  #Définition du bouton
        buttons.append(newbutton)  #Ajouter à la liste
        #newbutton.config(command= intermediateFunction(nameCase)) #Commande du bouton
        substitute = case[nameCase]
        newbutton.place(x=substitute[2], y=substitute[3])  #Placement du bouton
示例#16
0
文件: window.py 项目: timpauls/raypy
    def __init_window(self, height, width):
        self.master.title = "Ray Py"
        canvas = Canvas(self.master, width=width, height=height)
        canvas.pack(side=TOP)
        self.img = PhotoImage(width=width, height=height)
        canvas.create_image((width / 2, height / 2),
                            image=self.img,
                            state="normal")
        self.startButton = Button(self.master,
                                  text="Render",
                                  command=lambda: self.__onStartPressed())
        self.startButton.pack(side=RIGHT)
        self.resetButton = Button(self.master,
                                  text="Reset",
                                  command=lambda: self.__onResetPressed())
        self.resetButton.config(state="disabled")
        self.resetButton.pack(side=RIGHT)

        self.listbox = Listbox(self.master, height=5)
        self.listbox.bind('<<ListboxSelect>>', self.__selectTracer)
        self.listbox.insert(END, "Simple", "Shadow", "ShadingShadow",
                            "Recursive", "PathTracer")
        self.listbox.pack(side=LEFT)

        self.listbox.selection_set(0)
        self.listbox.activate(0)
        self.listbox.focus_set()
示例#17
0
    def __init__(self, master, text):
        self._text = text

        Frame.__init__(self,
                       master,
                       background=self.BACKGROUND,
                       highlightbackground="red",
                       borderwidth=1,
                       relief=SOLID)

        Label(self,
              text=text,
              background=self.BACKGROUND,
              foreground=self.FOREGROUND_LABEL).pack(side=LEFT,
                                                     pady=(self.PADDING[1],
                                                           self.PADDING[3]),
                                                     padx=(self.PADDING[0], 0))

        self._close_IMG = PhotoImage(
            data=
            "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAFySURBVDiNpZM9juJAEIU/WxPY/EstQdICEYAQ+A5eX2CjDTgiMRfwzh4BmcAkTgAJiZZFsF7TbvAmeMUKZoKhouqnrqp+9V5bZVnyStgvVQNv94cgCN6EEAsApdQ8DEPzGQ5gVRRul5ae5wW2bbNarUKl1HeAZ3jV5N8LhBCL6XQaSCmdy+WC53lBFEVLgNlsFkgpHYDr9RpEUbQAfjxQMMagtSaOY8bjsTOZTHyAXq/nrNdrRqMRWuvnO1BKzTebzdIYEwwGAyeOY4bDYQ3glpMkSZ4kSaiUmj/s4H4P/X7f73a7td1uh2VZSCnZ7/fZdrt9v+f/QKEKrXWptaZqnuc5xpinhnlQQQjxTQjhnk4n2u02AFWulPqjlPr5oQqtVstvNBpumqa4rsvhcPhdliWdTqeepin1et0tisIHPlYhz3Ns2+Z4PGZZlv264X6z2aydz2eMMfcl/6sALG8TKIrivTLSE/xTFb5m5a/Gy7/xL3CL+6G7+HoOAAAAAElFTkSuQmCC"
        )
        Button(self,
               highlightthickness=0,
               borderwidth=0,
               background=self.BACKGROUND,
               activebackground=self.BACKGROUND,
               image=self._close_IMG,
               command=self.destroy).pack(side=LEFT,
                                          pady=(self.PADDING[1],
                                                self.PADDING[3]),
                                          padx=(self.LABEL_AND_BUTTON_SPACING,
                                                self.PADDING[2]))
示例#18
0
def stat_image():
    img = PhotoImage(
        format="gif",
        data=
        "R0lGODlhEAAQAOYAAAAAAP///5dxdJNtdI9qdItncl6Atnef33uk5Fx+s3uk44Cp6Iav7Yav64Wt"
        +
        "6Yew64uz7oq18Yy384659JC79Y638ZC785S+9ZO99JbA9qjP+qvS+maRMGCILV6FLJLAQZG+QpK/"
        +
        "SJbEPpXDP5PBQJDEII3BH4q+H5PHIYy/I47CJJLEJZjLKJfHMpjIN6HPPJzKO57MPKTSP6LQPqDP"
        +
        "Pp/NPZrIPKXUQZjGPafTTLzlYsjteJfKI5rOJZXHJp7QKJvOKp/QLKPVLqTVMqnZN6nZO6bUPqPR"
        +
        "Pa7dQajWQq7cRKnWQ6zYRa3ZSLPgTLPfTrDcTrnjVbTfVLnjV7jhW8fsdMfsdaKOGqSGG6CBHJx8"
        +
        "Hph3IJRzIZFvIotsJuaRUuaSUvCMSPGUVPSgZ/Slbt1XBOBdCuBmGuVqG+NrH+d3Lut7Me2FQZcx"
        +
        "DZQxDaaAdqWIgqF8dZx2df///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5"
        +
        "BAEAAHMALAAAAAAQABAAAAe4gHOCg4SFhoU7VVVWTIeEOlFRU0aOg1ROTk9HlYJSSEhKL4MbGhuF"
        +
        "UERERTGDGRQZhU1CQkMwgxcTF4VLPz9BNoMYEhhwYF9gV0k9PUA4gxYRFm9kY2RYNzw8LCKDFQwV"
        +
        "cWJhYlkyKCg+I4MQCxBybGtsWjMlJSskgw8KDwJqaGpbaJgwoeLDIAcHHAxIYyYNlxonTqQAMagB"
        + "ggYEzpQ50yVHixYuQgwykMBAgTZu2njp4KElhzmBAAA7")
    return img
示例#19
0
def image(pos, file="../../car.gif"):
    x, y = pos
    img = PhotoImage(file=file)
    return _canvas.create_image(x,
                                y,
                                image=Tkinter.PhotoImage(file=file),
                                anchor=Tkinter.NW)
示例#20
0
    def run(self):
        print "Creating animation server..."
        if os.path.exists(SOCKET_NAME):
            os.remove(SOCKET_NAME)

        self.server = Animator(AnimationRequestHandler, self.simulate)
        if not self.simulate:
            print "Starting animation server..."
            print "Animation server is running on socket {0}".format(
                SOCKET_NAME)
            #print "Quit the server with CONTROL-C."
            self.server.serve_forever()
        else:
            print "Starting simulation..."
            button_window = Toplevel()
            button_window.title('Button Input')
            img = PhotoImage(file="easy_button.gif")
            single_easy_button = Button(button_window, image=img)
            single_easy_button.pack()
            single_easy_button.bind(
                "<Button-1>",
                lambda e: server.processCommand(ButtonEvent.SINGLEPRESS))
            double_easy_button = Button(button_window, text="double tap")
            double_easy_button.pack()
            double_easy_button.bind(
                "<Button-1>",
                lambda e: server.processCommand(ButtonEvent.DOUBLEPRESS))
            mainloop()
示例#21
0
文件: gui.py 项目: sangyf/ktailFSM
 def displaySampleFSM():
     resizeimage.resizeImage(filename,0.5)
     img = PhotoImage(file="../graph/sample0.5.png")
     label1.image = img # keep a reference!
     
     samplaCanvas.delete(img) #reset canvas
     samplaCanvas.create_image(0, 80, anchor='nw',image=img,tags="bg_img")
示例#22
0
    def box_filter(self):
        print "Box filter is used..."
        box_filter_pic = PhotoImage(
            width=self.width,
            height=self.height)  # preserve dimensions of orig. img

        for v in range(0, self.height):
            for u in range(0, self.width):
                summe = [0, 0, 0]  # create a filter region for every pixel
                for j in range(-1, 2):  # move filter
                    for i in range(-1, 2):
                        if 0 <= u + i < self.width:
                            if 0 <= v + j < self.height:
                                pixel = map(
                                    int,
                                    self.pixel_matrix[u + i][v + j].split())
                                summe = [
                                    sum([x, y]) for x, y in zip(pixel, summe)
                                ]
                            else:
                                pixel = map(int, self.pixel_matrix[u][
                                    v - 1].split())  # fill edge pixel
                                summe = [
                                    sum([x, y]) for x, y in zip(pixel, summe)
                                ]
                        else:
                            pixel = map(int, self.pixel_matrix[u - 1]
                                        [v].split())  # fill edge pixel
                            summe = [sum([x, y]) for x, y in zip(pixel, summe)]
                r, g, b = [x / 9.0 for x in summe]
                box_filter_pic.put("#%02x%02x%02x" % (int(r), int(g), int(b)),
                                   (u, v))
        print "Done!\n"
        return box_filter_pic
示例#23
0
    def _create_photo(self, path, name):
        """
		Creates a photo for use on the button.
		"""
        logger.debug("Create photo.\nPath: %r\nName: %r" % (path, name))

        return PhotoImage(format='gif', file=path % (name), name=name)
示例#24
0
def main_loop(gv):
    ret, frame = cap.read()
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

    if constants.face_algo == 'dlib':
        # frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        f = frame.astype(np.float32)
        f = np.transpose(f, (2, 0, 1))
        f = np.expand_dims(f, 0)
    elif constants.face_algo == 'haar':
        f = frame
    elif constants.face_algo is None:
        f = frame
    else:
        f = None

    y, bb = predict_frame(f, gv.model)
    if bb is not None:
        frame = draw_bb(frame, bb)

    img1 = Image.fromarray(frame, 'RGB')
    img2 = ImageTk.PhotoImage(img1)
    gv.camera_image = img2
    gv.camera.config(image=gv.camera_image)

    gv.series_e = plotting.update_series(gv.series_e, y[0].data[0])
    gv.series_a = plotting.update_series(gv.series_a, y[0].data[1])
    gv.series_c = plotting.update_series(gv.series_c, y[0].data[2])
    gv.series_s = plotting.update_series(gv.series_s, y[0].data[3])
    gv.series_o = plotting.update_series(gv.series_o, y[0].data[4])

    loc = plotting.make_plot(gv)
    gv.trait_image_all = PhotoImage(file=loc)
    gv.trait_all.config(image=gv.trait_image_all)
示例#25
0
    def append_chords(self, chords=[]):
        '''pass a [list] of Chords to the Accordion object'''

        self.update_idletasks()
        row = 0
        width = max([c.winfo_reqwidth() for c in chords])

        for c in chords:
            i = PhotoImage()  # blank image to force Label to use pixel size
            label = Label(self,
                          text=c.title,
                          image=i,
                          compound='center',
                          width=width,
                          bg=self.style['title_bg'],
                          fg=self.style['title_fg'],
                          bd=2,
                          relief='groove')

            label.grid(row=row, column=0)
            c.grid(row=row + 1, column=0, sticky='nsew')
            c.grid_remove()
            row += 2

            label.bind('<Button-1>', lambda e, c=c: self._click_handler(c))
            label.bind('<Enter>',
                       lambda e, label=label, i=i: label.config(bg=self.style[
                           'highlight']))
            label.bind('<Leave>',
                       lambda e, label=label, i=i: label.config(bg=self.style[
                           'title_bg']))
示例#26
0
    def initialize_main_panel(self):
        # Creates a menu.
        self.root.title("PyKeylogger Control Panel")
        self.root.config(height=200, width=200)

        # Overrides the default exit behaviour.
        self.root.protocol("WM_DELETE_WINDOW", self.close)

        # Display the version in main window
        g = Pmw.Group(self.root, tag_pyclass=None)
        g.pack(fill='both', expand=1, padx=6, pady=6)
        textlabel = Label(g.interior(),
                          text="PyKeylogger " + str(version.version),
                          font=("Helvetica", 18))
        textlabel.pack(padx=2, pady=2, expand='yes', fill='both')

        # Pretty logo display.
        photo = PhotoImage(file=os.path.join(get_main_dir(), version.name +
                                             "icon_big.gif"))
        imagelabel = Label(self.root, image=photo, height=160, width=200)
        imagelabel.photo = photo
        imagelabel.pack()

        # Create and pack the MessageBar.
        self.message_bar = Pmw.MessageBar(self.root,
                                          entry_width=50,
                                          entry_relief='groove',
                                          labelpos='w',
                                          label_text='Status:')
        self.message_bar.pack(fill='x', padx=10, pady=10)
        self.message_bar.message('state', 'Please explore the menus.')

        # Create main menu.
        menu = MainMenu(self.root, self.panelsettings, self)
示例#27
0
 def __init__(self, root, ctrl):
     self.__root = root
     self.__ctrl = ctrl
     self.__pluginDir = os.path.dirname(
         os.path.abspath(inspect.stack()[0][1]))
     self.__ico = PhotoImage(file=self.__pluginDir +
                             '/pic/ScribusGenerator_logo.gif')
     root.tk.call('wm', 'iconphoto', root._w, '-default', self.__ico)
示例#28
0
 def __init__(self, master=Tk()):
     Frame.__init__(self, master)
     self.grid()
     self.image = Image.open("test.jpg")
     self.photo = PhotoImage(self.image)
     self.label = Label(master, image=self.photo)
     self.label.image = photo
     self.label.pack()
示例#29
0
 def create_key(self, img, key):
     key_image = PhotoImage(file=img)
     label = Label(self, image=key_image, bd=0)
     label.image = key_image
     label.place(x=key[0], y=0)
     label.name = key[1]
     label.bind('<Button-1>', self.button_pressed)
     return label
示例#30
0
def _load_imgs(imgdir):
    imgdir = os.path.expanduser(imgdir)
    if not os.path.isdir(imgdir):
        raise Exception("%r is not a directory, can't load images" % imgdir)
    for f in glob.glob("%s/*.gif" % imgdir):
        img = os.path.split(f)[1]
        name = img[:-4]
        imgs[name] = PhotoImage(name, file=f, format="gif89")