Ejemplo n.º 1
0
def get_image(image):
    try:
        img = tk.PhotoImage(file=image)
    except:
        img = BitmapImage(data=BITMAP)
        # img = tk.PhotoImage(image=bitmap)
    return img
Ejemplo n.º 2
0
def imagens():
    return {
        'Switch': PhotoImage(file="{}sw.png".format(IMAGE_PATH)),
        'Host': PhotoImage(file="{}pc.png".format(IMAGE_PATH)),
        'Router': PhotoImage(file="{}router.png".format(IMAGE_PATH)),
        'NetLink': PhotoImage(file="{}netlink.png".format(IMAGE_PATH)),
        'Start': PhotoImage(file="{}play.png".format(IMAGE_PATH)),
        'Stop': PhotoImage(file="{}stop.png".format(IMAGE_PATH)),
        'Select': BitmapImage(
            file='/usr/include/X11/bitmaps/left_ptr' ),
        
    }
    def initUI(self):
        self.overrideredirect(True)  ## removes the window decoration

        bitmap = BitmapImage(
            data=BITMAP)  ## a bitmap is created from the data provided

        msg = "Click on the grip to move\nRight click to terminate"
        self.label = Label(self, text=msg)
        self.grip = Label(self, image=bitmap)
        self.grip.image = bitmap
        self.grip.pack(side="left", fill="y")
        self.label.pack(side="right", fill="both", padx=3, expand=True)
        self.grip.bind("<ButtonPress -1>", self.startMove)
        self.grip.bind("<ButtonRelease -1>", self.stopMove)
        self.grip.bind("<B1-Motion >", self.onMotion)
        self.bind("<ButtonPress -3>", self.onRightClick)
        self.geometry("+300+300")
Ejemplo n.º 4
0
            font='-weight bold'
            ).grid(
                column=3,
                row=0,
                sticky=W
                )
        # Calculated sec text label.
        ttk.Label(
            calculation_frame,
            text='sec.'
            ).grid(
                column=4,
                row=0,
                sticky=W
                )


# Now, let's turn on the heat!
if __name__ == '__main__':
    root = Tk()
    root.title('Microwave')
    # Place window near the centre on the desktop.
    screen_width = str(int((root.winfo_screenwidth()) / 2 - 85))
    screen_height = str(int((root.winfo_screenheight()) / 2 - 200))
    desktop = '-' + screen_width + '+' + screen_height
    root.geometry(desktop)
    # Load and assign image.
    imgobj = BitmapImage(file='img/microwave.xbm', foreground='#555')
    app = App(root)
    root.mainloop()
Ejemplo n.º 5
0
 def img(self):
     return BitmapImage(data=self._qr.xbm(scale=8))
Ejemplo n.º 6
0
        history_scroll.grid(column=0, row=4, padx=0, pady=8, sticky=(N, S, E))
        history_box = Listbox(
            frame_one,
            listvariable=history_var,
            font='courier',
            width=16,
            height=5,
            state='disabled',
            disabledforeground='black',
            # selectmode='extended',
            takefocus=0,
            yscrollcommand=history_scroll.set)
        history_box.grid(column=0, row=4, padx=8, pady=8, sticky=(N, S, W))
        history_scroll.config(command=history_box.yview)


# Let's put this thing in motion!
if __name__ == '__main__':
    root = Tk()
    root.title('flASh!..bOOm!')
    # Load and assign images, odd it has to be here, but else won't work.
    img_flash = BitmapImage(file="img/flash.xbm", foreground='orange')
    img_boom = BitmapImage(file="img/boom.xbm", foreground='red')
    # Place window somewhere near the centre on the desktop.
    screen_width = str(int(root.winfo_screenwidth() / 2 - 100))
    screen_height = str(int(root.winfo_screenheight() / 2 - 200))
    desktop = '-' + screen_width + '+' + screen_height
    root.geometry(desktop)
    app = App(root)
    root.mainloop()
Ejemplo n.º 7
0
from tkinter import Tk, BitmapImage, Button

if __name__ == '__main__':
    # BitmapImage
    # Конструктор класса принимает следующие аргументы:
    # background и foreground - цвета фона и переднего плана для изображения.
    # Поскольку изображение двухцветное, то эти параметры определяют соответственно чёрный и белый цвет.

    # file и maskfile - пути к файлу с изображением и к маске
    # (изображению, указывающему какие пиксели будут прозрачными).

    # data и maskdata - вместо пути к файлу можно указать уже загруженные в память данные изображения.
    # Данная возможность удобна для встраивания изображения в программу.
    root = Tk()
    data = '''
    #define image_width 15
    #define image_height 15
    static unsigned char image_bits[] = {
       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x30, 0x0c, 0x60, 0x06,
       0x60, 0x06, 0xc0, 0x03, 0xc0, 0x03, 0x60, 0x06, 0x60, 0x06, 0x30, 0x0c,
       0x38, 0x1c, 0x00, 0x00, 0x00, 0x00 };'''
    image = BitmapImage(data=data, background='red', foreground='black')
    button = Button(root, image=image)
    button.pack()
    root.mainloop()
Ejemplo n.º 8
0
 def reloadImg(self):
     self.img = BitmapImage(file="img/king.xbm")
Ejemplo n.º 9
0
 def __init__(self, x, y, team, board):
     super().__init__(x, y, team, board)
     self.img = BitmapImage(file="img/king.xbm")
Ejemplo n.º 10
0
 def reloadImg(self):
     self.img = BitmapImage(file="img/queen.xbm")
Ejemplo n.º 11
0
 def getImg(self):
     self.img = BitmapImage(file="img/bomb" + str(self.timer) + ".xbm")
     return super().getImg()
Ejemplo n.º 12
0
 def reloadImg(self):
     self.img = BitmapImage(file="img/bomb" + str(self.timer) + ".xbm")
Ejemplo n.º 13
0
 def __init__(self, x, y, team, board):
     super().__init__(x, y, team, board)
     self.timer = 5
     self.img = BitmapImage(file="img/bomb" + str(self.timer) + ".xbm")
Ejemplo n.º 14
0
 def __init__(self, x, y, team, board):
     super().__init__(x, y, team, board)
     self.img = BitmapImage(file="img/pawn.xbm")
     self.firstturn = True
Ejemplo n.º 15
0
 def reloadImg(self):
     self.img = BitmapImage(file="img/bishop.xbm")
Ejemplo n.º 16
0
 def reloadImg(self):
     self.img = BitmapImage(file="img/spider.xbm")