当前位置: 首页>>代码示例>>Python>>正文


Python tkinter.NW属性代码示例

本文整理汇总了Python中tkinter.NW属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.NW属性的具体用法?Python tkinter.NW怎么用?Python tkinter.NW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在tkinter的用法示例。


在下文中一共展示了tkinter.NW属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _write

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def _write(self, ch, fg, bg):
        if self.x == self.width:
            self.x = 0
            self.y+=1
            if self.y == self.height:
                [self.canvas.move(x,0,-fontHeight) for x in self.canvas.find_all()]
                self.y-=1
        canvasX = self.x*fontWidth + 1
        canvasY = self.y*fontHeight + 1
        items = self.canvas.find_overlapping(canvasX, canvasY, canvasX+2, canvasY+2)
        if items:
            [self.canvas.delete(item) for item in items]
        if bg:
            self.canvas.create_rectangle(canvasX, canvasY, canvasX+fontWidth-1, canvasY+fontHeight-1, fill=bg, outline=bg)
        self.canvas.create_text(canvasX, canvasY, anchor=Tkinter.NW, font=ttyFont, text=ch, fill=fg)
        self.x+=1 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:18,代码来源:tkvt100.py

示例2: draw_bulb_icon

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def draw_bulb_icon(self, bulb, label):
        """ Given a bulb and a name, add the icon to the end of the row. """
        # Make room on canvas
        self.scrollx += self.icon_width
        self.canvas.configure(scrollregion=(0, 0, self.scrollx, self.scrolly))
        # Build icon
        path = self.icon_path()
        sprite = tkinter.PhotoImage(file=path, master=self.master)
        image = self.canvas.create_image(
            (self.current_icon_width + self.icon_width - self.pad, self.icon_height / 2 + 2 * self.pad), image=sprite,
            anchor=tkinter.SE, tags=[label])
        text = self.canvas.create_text(self.current_icon_width + self.pad / 2, self.icon_height / 2 + 2 * self.pad,
                                       text=label[:8], anchor=tkinter.NW, tags=[label])
        self.bulb_dict[label] = (sprite, image, text)
        self.update_icon(bulb)
        # update sizing info
        self.current_icon_width += self.icon_width 
开发者ID:samclane,项目名称:LIFX-Control-Panel,代码行数:19,代码来源:icon_list.py

示例3: add_item

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def add_item(self, text, font=("default", 12, "bold"), backgroundcolor="yellow", textcolor="black",
                 highlightcolor="blue"):
        """
        Add a new item on the Canvas.
        
        :param text: text to display
        :type text: str
        :param font: font of the text
        :type font: tuple or :class:`~tkinter.font.Font`
        :param backgroundcolor: background color
        :type  backgroundcolor: str
        :param textcolor: text color
        :type  textcolor: str
        :param highlightcolor: the color of the text when the item is selected
        :type  highlightcolor: str
        """
        item = self.canvas.create_text(0, 0, anchor=tk.NW, text=text, font=font, fill=textcolor, tag="item")
        rectangle = self.canvas.create_rectangle(self.canvas.bbox(item), fill=backgroundcolor)
        self.canvas.tag_lower(rectangle, item)
        self.items[item] = rectangle
        if callable(self._callback_add):
            self._callback_add(item, rectangle)
        self.item_colors[item] = (backgroundcolor, textcolor, highlightcolor) 
开发者ID:TkinterEP,项目名称:ttkwidgets,代码行数:25,代码来源:itemscanvas.py

示例4: draw_categories

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def draw_categories(self):
        """Draw the category labels on the Canvas"""
        for label in self._category_labels.values():
            label.destroy()
        self._category_labels.clear()
        canvas_width = 0
        for category in (sorted(self._categories.keys() if isinstance(self._categories, dict) else self._categories)
                         if not isinstance(self._categories, OrderedDict)
                         else self._categories):
            kwargs = self._categories[category] if isinstance(self._categories, dict) else {"text": category}
            kwargs["background"] = kwargs.get("background", self._background)
            kwargs["justify"] = kwargs.get("justify", tk.LEFT)
            label = ttk.Label(self._frame_categories, **kwargs)
            width = label.winfo_reqwidth()
            canvas_width = width if width > canvas_width else canvas_width
            self._category_labels[category] = label
        self._canvas_categories.create_window(0, 0, window=self._frame_categories, anchor=tk.NW)
        self._canvas_categories.config(width=canvas_width + 5, height=self._height) 
开发者ID:TkinterEP,项目名称:ttkwidgets,代码行数:20,代码来源:timeline.py

示例5: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def __init__(self, parent, **kwargs):
        super().__init__(parent, highlightthickness=0, **kwargs)
       
        vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
        vscrollbar.pack(side=tk.RIGHT, fill=tk.Y)
      
        self.canvas = canvas = tk.Canvas(self, bd=2, highlightthickness=0,
                        yscrollcommand=vscrollbar.set)
        
        canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        vscrollbar.config(command=canvas.yview)
        
        canvas.xview_moveto(0)
        canvas.yview_moveto(0)

        self.interior = interior = tk.Frame(canvas)
        self.interior_id = canvas.create_window(0, 0,
            window=interior,
            anchor=tk.NW)
        
        self.interior.bind("<Configure>", self.configure_interior)
        self.canvas.bind("<Configure>", self.configure_canvas)
        self.scrollbar = vscrollbar
        self.mouse_position = 0 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:26,代码来源:tkwidgets.py

示例6: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def __init__(self, parent, item, **kwargs):
        super().__init__(parent, **kwargs)
        self.grid_columnconfigure(0, weight=1)
        label = tk.Label(self, font=self.font, text=f"{item.name}", width=25, justify=tk.LEFT, anchor=tk.NW)
        self.ticket = item
        self.options = [lib.ToggleSwitch(self, text=option, font=self.font, width=15) for option in item.options]
        self._comments = tk.StringVar(self)
        comment = item.parameters.get("comments", "")
        self._comments.set(comment if comment else "Comments")
        self.comments = tk.Entry(self, textvariable=self._comments, font=self.font)
        self.grid_columnconfigure(0, weight=1)

        label.grid(row=0, column=0, columnspan=2, sticky="nswe", padx=5, pady=5)
        tk.Label(self, text="    ", font=self.font).grid(row=1, column=0, sticky="nswe")
        for i, option in enumerate(self.options):
            if option["text"] in item.selected_options:
                option.state = True
            option.grid(row=i+1, column=1, sticky="nwe", padx=5, pady=5)
        
        self.grid_rowconfigure(len(self.options) + 2, weight=1)
        self.comments.grid(row=len(self.options) + 2, column=0, columnspan=2, pady=5, padx=5, sticky="swe")
        self.comments.bind("<FocusIn>", self.on_entry_focus) 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:24,代码来源:options.py

示例7: add_text

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def add_text(self):
        padding = 100

        def add_sequences(sequences, x, y):
            for sequence in sequences:
                x += padding
                if sequence is None:
                    sequence = ''
                for char in sequence:
                    self.chars.append((char, (x, y)))
                    self.canvas.create_text(x, y, text=char, anchor=tk.NW, font=font1, fill='white')
                    x += font1Size
            return x, y

        x = 0
        y = padding

        add_sequences([self.initial, self.modified], x, y)

        x = 0
        y += padding

        add_sequences([self.target, self.answer], x, y) 
开发者ID:fargonauts,项目名称:copycat,代码行数:25,代码来源:workspacecanvas.py

示例8: create_top_display

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def create_top_display(self):
        frame = tk.Frame(self.root)
        glass_frame_image = tk.PhotoImage(file='../icons/glass_frame.gif')
        self.canvas = tk.Canvas(frame, width=370, height=90)
        self.canvas.image = glass_frame_image
        self.canvas.grid(row=1)
        self.console = self.canvas.create_image(
            0, 10, anchor=tk.NW, image=glass_frame_image)
        self.clock = self.canvas.create_text(125, 68, anchor=tk.W, fill='#CBE4F6',
                                             text="00:00")
        self.track_length_text = self.canvas.create_text(167, 68, anchor=tk.W, fill='#CBE4F6',
                                                         text="of 00:00")
        self.track_name = self.canvas.create_text(50, 35, anchor=tk.W, fill='#9CEDAC',
                                                  text='\"Currently playing: none \"')
        self.seek_bar = Seekbar(
            frame, background="blue", width=SEEKBAR_WIDTH, height=10)
        self.seek_bar.grid(row=2, columnspan=10, sticky='ew', padx=5)
        frame.grid(row=1, pady=1, padx=0) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Blueprints-Second-Edition,代码行数:20,代码来源:view.py

示例9: create_widgets

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def create_widgets(self):
        '''Create the tkinter UI'''
        if self.chan_num != -1:
            self.results_group = tk.LabelFrame(
                self, text="Results", padx=3, pady=3)
            self.results_group.pack(
                fill=tk.X, anchor=tk.NW, padx=3, pady=3)

            self.data_frame = tk.Frame(self.results_group)
            self.data_frame.grid()

            button_frame = tk.Frame(self)
            button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)

            self.start_button = tk.Button(button_frame)
            self.start_button["text"] = "Start"
            self.start_button["command"] = self.start
            self.start_button.grid(row=0, column=0, padx=3, pady=3)

            quit_button = tk.Button(button_frame)
            quit_button["text"] = "Quit"
            quit_button["command"] = self.master.destroy
            quit_button.grid(row=0, column=1, padx=3, pady=3)
        else:
            self.create_unsupported_widgets(self.board_num) 
开发者ID:mccdaq,项目名称:mcculw,代码行数:27,代码来源:CInScan02.py

示例10: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def __init__(self, master, im, value=128):
        tkinter.Frame.__init__(self, master)

        self.image = im
        self.value = value

        self.canvas = tkinter.Canvas(self, width=im.size[0], height=im.size[1])
        self.backdrop = ImageTk.PhotoImage(im)
        self.canvas.create_image(0, 0, image=self.backdrop, anchor=tkinter.NW)
        self.canvas.pack()

        scale = tkinter.Scale(self, orient=tkinter.HORIZONTAL, from_=0, to=255,
                              resolution=1, command=self.update_scale,
                              length=256)
        scale.set(value)
        scale.bind("<ButtonRelease-1>", self.redraw)
        scale.pack()

        # uncomment the following line for instant feedback (might
        # be too slow on some platforms)
        # self.redraw() 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:23,代码来源:thresholder.py

示例11: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def __init__(self, master, image):
        tkinter.Canvas.__init__(self, master,
                                width=image.size[0], height=image.size[1])

        # fill the canvas
        self.tile = {}
        self.tilesize = tilesize = 32
        xsize, ysize = image.size
        for x in range(0, xsize, tilesize):
            for y in range(0, ysize, tilesize):
                box = x, y, min(xsize, x+tilesize), min(ysize, y+tilesize)
                tile = ImageTk.PhotoImage(image.crop(box))
                self.create_image(x, y, image=tile, anchor=tkinter.NW)
                self.tile[(x, y)] = box, tile

        self.image = image

        self.bind("<B1-Motion>", self.paint) 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:20,代码来源:painter.py

示例12: image

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def image(x, y, fileName, anchor = NW, **kwargs):
  if type(x) == tuple:
    fileName = y
    x, y = x
  x, y = transformCoord ( x, y )
  try:
   if fileName.lower().endswith('.gif'):
     newImage = tkinter.PhotoImage(file = fileName)
   else:
     im = Image.open(fileName)
     newImage = ImageTk.PhotoImage(im)
  except:
   pass
  _images.append(newImage)
  img = _C.create_image(x, y, image = newImage, anchor = anchor, **kwargs)
  return img
#---------------------------------- 
开发者ID:tkhirianov,项目名称:lections_2019,代码行数:19,代码来源:graph.py

示例13: Load_T2

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def Load_T2(self, event=None):
        """
        """
        self.T2filename = filedialog.askopenfilename()
        nib_vol = nib.load(self.T2filename)
        self.affine = nib_vol.affine
        self.T2_vol = nib_vol.get_data()

        mid_slice = self.T2_vol.shape[2]//2

        true_size = self.T2_vol.shape[:2]
        size = (self.T2_canvas.winfo_width(), self.T2_canvas.winfo_height())
        size = (size[0], int(true_size[0]/true_size[1])*size[1]) if size[0] < size[1] else (int(true_size[1]/true_size[0])*size[0], size[1])

        self.T2_canvas_image = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(plot_normalize(self.T2_vol[:,:,mid_slice].T)).resize(size))
        self.T2_canvas.create_image(0, 0, image=self.T2_canvas_image, anchor=tk.NW)
        self.update_main_view(self.T2_vol, self.T2_vol.shape[0]//2, self.T2_vol.shape[1]//2, self.T2_vol.shape[2]//2)
        self.init_scales(self.T2_vol) 
开发者ID:koriavinash1,项目名称:DeepBrainSeg,代码行数:20,代码来源:DeepBrainSegUI.py

示例14: Load_T1

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def Load_T1(self, event=None):
        self.T1filename = filedialog.askopenfilename()
        nib_vol = nib.load(self.T1filename)
        self.affine = nib_vol.affine
        self.T1_vol = nib_vol.get_data()

        mid_slice = self.T1_vol.shape[2]//2

        true_size = self.T1_vol.shape[:2]
        size = (self.T1_canvas.winfo_width(), self.T1_canvas.winfo_height())
        size = (size[0], int(true_size[0]/true_size[1])*size[1]) if size[0] < size[1] else (int(true_size[1]/true_size[0])*size[0], size[1])


        self.T1_canvas_image = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(plot_normalize(self.T1_vol[:,:,mid_slice].T)).resize(size))
        self.T1_canvas.create_image(0, 0, image=self.T1_canvas_image, anchor=tk.NW)
        self.update_main_view(self.T1_vol, self.T1_vol.shape[0]//2, self.T1_vol.shape[1]//2, self.T1_vol.shape[2]//2)
        self.init_scales(self.T1_vol) 
开发者ID:koriavinash1,项目名称:DeepBrainSeg,代码行数:19,代码来源:DeepBrainSegUI.py

示例15: Load_Flair

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NW [as 别名]
def Load_Flair(self, event=None):
        self.Flairfilename = filedialog.askopenfilename()
        nib_vol = nib.load(self.Flairfilename)
        self.affine = nib_vol.affine
        self.Flair_vol = nib_vol.get_data()

        mid_slice = self.Flair_vol.shape[2]//2

        true_size = self.Flair_vol.shape[:2]
        size = (self.Flair_canvas.winfo_width(), self.Flair_canvas.winfo_height())
        size = (size[0], int(true_size[0]/true_size[1])*size[1]) if size[0] < size[1] else (int(true_size[1]/true_size[0])*size[0], size[1])


        self.Flair_canvas_image = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(plot_normalize(self.Flair_vol[:,:,mid_slice].T)).resize(size))
        self.Flair_canvas.create_image(0, 0, image=self.Flair_canvas_image, anchor=tk.NW)
        self.update_main_view(self.Flair_vol, self.Flair_vol.shape[0]//2, self.Flair_vol.shape[1]//2, self.Flair_vol.shape[2]//2)
        self.init_scales(self.Flair_vol) 
开发者ID:koriavinash1,项目名称:DeepBrainSeg,代码行数:19,代码来源:DeepBrainSegUI.py


注:本文中的tkinter.NW属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。