def __init__(self, parent=None, width=800, height=800, background="white"): """ Initialisation parent : le parent dans l'application width,height : dimension de l'ecran background : fond d'ecran signal_X, ... : identifiants des signaux color_X, ... : couleur d'affichage des siganux """ Canvas.__init__(self) self.parent = parent self.width = width self.height = height self.signal_X = None self.color_X = "red" self.signal_Y = None self.color_Y = "green" self.signal_XY = None self.color_XY = "#ff00ff" self.grid = [] self.configure(bg=background, bd=2, relief="sunken") self.bind("<Configure>", self.resize)
def __init__(self, parent): Canvas.__init__(self, width=WIDTH, height=HEIGHT, background="black", highlightthickness=0) self.parent = parent self.initGame() self.pack()
def __init__(self, window,color, value, maxVal, name, gaugeScale, lineColor, bgColor, textFont): Canvas.__init__(self, window, bg=bgColor, height=100, width=100) xval = 20 yval = 10 self.maxVal = maxVal self.value = value self.gaugeValue = self.maxVal / float(value) # calculate the GaugeValue self.hand = self.create_arc(xval, yval, (xval + 100 * gaugeScale), (yval + 100 * gaugeScale), start=0, extent=-(220 / self.gaugeValue), fill=color) # Draw hand self.outline = self.create_arc(xval - 3, yval - 3, (xval + 100 * gaugeScale + 3), (yval + 100 * gaugeScale + 3), start=0, extent=-220, style="arc", outline=lineColor, width=2) # draw outline self.valueBox = self.create_rectangle((xval + 50 * gaugeScale), yval + 20 * gaugeScale, xval + 100 * gaugeScale + 3, yval + 50 * gaugeScale, outline=lineColor, width=2) # draw Value Box self.value1 = self.create_text(xval + 54 * gaugeScale, yval + 22 * gaugeScale, anchor="nw", text=self.value, fill=lineColor, font=(textFont, int(round(15 * gaugeScale)))) self.value2 = self.create_text(xval-10, yval - 8, anchor="nw", text=name, fill=lineColor, font=(textFont, int(round(19 * gaugeScale))))
def __init__(self, parent, x_coord, y_coord, scale, max_x, max_y, bgcolor): Canvas.__init__(self, parent, relief=RAISED, borderwidth=2, bg=bgcolor, width=x_coord * 2 + max_x * scale, height=y_coord * 2 + max_y * scale) self.parent = parent self.scaled_max_x = max_x * scale self.scaled_max_y = max_y * scale self.scale = scale self.create_rectangle(x_coord, y_coord, x_coord + max_x * scale + 2, x_coord + max_y * scale + 2, outline="#f11", width=2) self.font_5x7 = MyFont(self, x_coord, y_coord, "Courier", "normal", 8, 19, 5, 8, 7, scale, bgcolor) self.font_8x8 = MyFont(self, x_coord, y_coord, "Monospace", "bold", 8, 12, 8, 8, 7, scale, bgcolor) self.font_8x16 = MyFont(self, x_coord, y_coord, "Monospace", "normal", 4, 12, 8, 16, 15, scale, bgcolor) self.font = self.font_5x7
def __init__(self, root, data, horizontaljoin=False, ratiocallback=None, buttoncallback=None): """ Create a new scopetube. :param root: is the main window :param data: is the data to display (or update if enabled) :param horizontaljoin: if true the points are joined through horizontal segments then vertica (for waveditor) if it is false they are just joined as useful in the scope view :param buttoncallback: it is the function to provide if the user can manage the graphs changing point (for wave editor) :returns: a new instance of scope """ Canvas.__init__(self, root, background='white') self.bind('<Button-1>', self.bndbtnmovebegin) self.bind('<B1-Motion>', self.bndbtnmove) self.bind('<ButtonRelease-1>', self.bndbtnmoveend) self.bind('<Button-2>', self.bndbtnfit) self.bind('<Button-4>', self.bndbtnzoom) self.bind('<Button-5>', self.bndbtnzoom) root.bind('<MouseWheel>', self.bndbtnzoom) # do not understand why if bind to this canvas does not catch the mousewheel self.bind('<ButtonRelease-3>', self.bndbtnpntins) self.horizontaljoin = horizontaljoin self.points = data self.dpsfile = Dpsfile(self.points) self.ratiocallback = ratiocallback self.buttoncallback = buttoncallback
def __init__(self, master, width, data_callback): """Construct a Meter. :param master :param width :param data_callback: function to retrieve meter data :param end_callback: function to call upon completion """ Canvas.__init__(self, master, bg=COLOR_METER_BG, borderwidth=2, relief=Tkinter.GROOVE, width=width, height=METER_HEIGHT) self._data_callback = data_callback self._width = (int)(self.cget("width")) self._x0 = 0 self._y0 = METER_HEIGHT - 25 self._x1 = self._width + 5 self._y1 = METER_HEIGHT self.create_text(10, 60, anchor=Tkinter.W, font=FONT_SMALL, text=TEXT_POSITION, fill=COLOR_METER_TEXT) self.create_text(140, 60, anchor=Tkinter.W, font=FONT_SMALL, text=TEXT_LENGTH, fill=COLOR_METER_TEXT) self.create_text(270, 60, anchor=Tkinter.W, font=FONT_SMALL, text=TEXT_CUE, fill=COLOR_METER_TEXT) self._position = self.create_text(10, 85, anchor=Tkinter.W, font=FONT_NUM, fill=COLOR_METER_TEXT) self._length = self.create_text(140, 85, anchor=Tkinter.W, font=FONT_NUM, fill=COLOR_METER_TEXT) self._cue = self.create_text(270, 85, anchor=Tkinter.W, font=FONT_NUM, fill=COLOR_METER_TEXT) self._title = self.create_text(10, 20, anchor=Tkinter.W, font=FONT_HEAD, fill=COLOR_METER_TEXT) self._artist = self.create_text(self._width, 20, anchor=Tkinter.E, font=FONT_HEAD, fill=COLOR_METER_TEXT) self._bar_bg = self.create_rectangle(self._x0, self._y0, self._x1, self._y1, fill=COLOR_BAR_BG) self._bar_fg = self.create_rectangle(self._x0, self._y0, self._x0, self._y1, fill=COLOR_BAR_FG) self.reset()
def __init__(self, master, width, height, n_classes=_N_CLASSES, fuel_color_map=DEFAULT_FUEL_COLOR_MAP, color_scheme_map=DEFAULT_GRADIENT_COLOR_SCHEMES, color_scheme=BLACK_SCHEME): """ :param master: :param width: :param height: :param n_classes: :param fuel_color_map: :param color_scheme: """ Canvas.__init__(self, master=master, width=width, height=height) self._height = height self._width = width self._n_classes = n_classes self._fuel_color_map = fuel_color_map self._color_schemes = color_scheme_map self._color_scheme = color_scheme self._elev_min, self._elev_max = None, None self._ign_min, self._ign_max = None, None self._active_part = View._FUEL_ACTIVE self._is_view_changed = False
def __init__(self, master, image): self.height_ratio = 1 width, height = image.size pixels = image.load() RED, GREEN, BLUE = range(3) self.colors = [ '#{0:02x}{1:02x}{2:02x}'.format( contrast( sum(pixels[x, y][RED] for x in xrange(width)) / width), contrast( sum(pixels[x, y][GREEN] for x in xrange(width)) / width), contrast( sum(pixels[x, y][BLUE] for x in xrange(width)) / width)) for y in xrange(height) ] if height / float(width) > 1.5: width *= 2 elif width < 200: width *= 2 height *= 2 self.height_ratio = 2 if (width, height) != image.size: image = image.resize((width, height)) Canvas.__init__(self, master, width=width, height=height) self.tk_img = ImageTk.PhotoImage(image) self.update_image() self.pack()
def __init__(self, master=None, fps=20, *args, **kw): Canvas.__init__(self, master, *args, **kw) self.frame = Frame3D() self.items = {} self.w = float(self['width']) self.h = float(self['height']) self.axes_on = True self._xy_axes() self.bind('<Configure>', self.resize_callback) self.fps_ms = 1000 / fps # Frames per second in milliseconds. self.focal_distance = 2.2 self.x_arc_of_view = 73.0 self.y_arc_of_view = 73.0 self.f = G(self.w, self.x_arc_of_view) self.u = G(self.h, self.y_arc_of_view) self._frustum = Frustum( self.w, self.h, self.x_arc_of_view, self.y_arc_of_view, self.focal_distance, )
def __init__(self, parent, graph): Canvas.__init__(self, parent, width=graph.width, height=graph.height) for e in graph.edges: self.create_line(*[i for j in e for i in graph.vertex[j]]) self.vertex = {k: self.createCircle(v[0], v[1], 6, fill="black") for k, v in graph.vertex.items()} self.pack()
def __init__(self, window,color, value,name, lineColor, bgColor, textFont): Canvas.__init__(self, window, bg=bgColor, height=100, width=100) xval = 20 yval = 10 self.value = value self.value1 = self.create_text(xval + 54, yval + 22, anchor="nw", text=name + " " + str(self.value), fill=lineColor, font=(textFont, int(round(15))))
def __init__(self, parent, height=30, width=150, increments=15): self.increments = increments self.height = height self.increment_width = width/increments-2 self.current_increment = 0 Canvas.__init__(self, parent, height=height, width=width, bd=0) self.create_rectangle(1, 1, width-1, height-1, fill="") self.xview_moveto(0) self.yview_moveto(0)
def __init__(self,parent,**kwargs): Canvas.__init__(self,parent,**kwargs) self.bind("<Configure>", self._on_resize) self.height,self.original_height = 700,700 self.width,self.original_width = 1300,1300 self.fonts = FontContainer() self.animations = {} self.animation_queue = [] self.children_original_dimensions = {}
def __init__(self,dim,**kwargs): self.dim=dim self.space=space self.wood_color=(.9*236,.9*206,.9*124) Canvas.__init__(self,**kwargs) self.prepare_mesh() self.no_redraw=[] self.anchor_x=0 self.anchor_y=0
def __init__(self, master, grid, w, h, *args, **kwargs): Canvas.__init__(self, master, *args, **kwargs) self.max_width = w self.max_height = h self.width = w self.height = h self._fill_color = 'black' self._bg_color = 'white' self._grid_line_width = 1 self.draw_grid(grid)
def __init__(self, stats_gui=None, parent=None, run=None, column=None, row=None, sq_size=15, delay=20, *args, **kwargs): Canvas.__init__(self, parent, bg='white', highlightthickness=0, borderwidth=0, *args, **kwargs) self.sqsize = sq_size self.run = run self.delay = delay self.stats = stats_gui self.column = column self.row = row
def __init__(self, dim, **kwargs): self.dim = dim self.space = space self.wood_color = (214, 174, 114) #same as gogui Canvas.__init__(self, **kwargs) self.anchor_x = 0 self.anchor_y = 0 self.define_goban_style() self.create_goban() self.temporary_shapes = []
def __init__(self, dim, **kwargs): self.dim = dim self.space = space self.wood_color = (.9 * 236, .9 * 206, .9 * 124) Canvas.__init__(self, **kwargs) self.anchor_x = 0 self.anchor_y = 0 self.define_goban_style() self.create_goban() self.temporary_shapes = []
def __init__(self, parent, clf, mb, note_sample_window_size): Canvas.__init__(self, parent, bg="#FFFFFF", width = self.WIDTH, height = self.HEIGHT) self.tclef = PhotoImage(file="./images/tclef.gif", master=self) self.bclef = PhotoImage(file="./images/bclef.gif", master=self) print self.tclef self.last_note_set = () self.notes = [] self.clf = clf self.mb = mb self.note_sample_window_size = note_sample_window_size self.update_staff()
def __init__(self, master, **cnf): Canvas.__init__(self, master, highlightthickness=0) self.__model = RangeSliderModel() self.__controller = RangeSliderController(self.__model, self) self.configure(**cnf) self.__model.subscribe(self.__controller.update) self.bind("<Configure>", self.__resize) self.bind("<Key>", self.__controller.rangeSlider_onKeyPress) # critical to the focus subsystem! self.master.bind("<Button>", self.__focusCheck, add="+") self.master.bind("<Key>", self.__focusCheck, add="+")
def __init__(self, master, filename=None, data=None, start_animation=True, time=40, **kwargs): if data is not None: self._image = Image.open(BytesIO(base64.b64decode(data))) elif filename is not None: self._image = Image.open(filename) elif hasattr(self, "data"): self._image = Image.open(BytesIO(base64.b64decode(self.data))) else: raise Exception("No image data or file") if self._image.format == "XBM": self._imagetk_class = ImageTk.BitmapImage else: self._imagetk_class = ImageTk.PhotoImage width, height = self._image.size self._time = time kwargs.setdefault("width", width) kwargs.setdefault("height", height) kwargs.setdefault("highlightthickness", 0) if "borderwidth" not in kwargs and "bd" not in kwargs: kwargs["borderwidth"] = 0 Canvas.__init__(self, master, **kwargs) self._bind_tag = "icon_rotating%s" % RotatingIcon._bind_tag_ID RotatingIcon._bind_tag_ID += 1 self.bind_class(self._bind_tag, "<Unmap>", self._on_unmap) self.bind_class(self._bind_tag, "<Map>", self._on_map) self._running = False self._is_mapped = False if start_animation: self.start_animation()
def __init__(self, parent=None, width=800, height=800, background="white"): """ initialisation parent : un Oscilloscope width,height : dimension de l'ecran background : fond d'ecran """ Canvas.__init__(self) self.parent = parent self.width = width self.height = height self.signal_X = None self.color_X = "red" self.configure(bg=background, bd=2, relief="sunken") self.bind("<Configure>", self.resize)
def __init__(self, master, track, beat, is_stressed): Canvas.__init__(self, master, width=20, height=20, highlightthickness=0) self.bind('<Button-1>', lambda _: self.command()) self.bind('<<Toggle-Visual>>', lambda _: self.toggle_visual()) self.track = track self.beat = beat self.playing = False self.is_stressed = is_stressed self.toggle_visual() self.changed = True
def __init__(self, preview_id, img_path = PATH_BLANK_PICTURE, img_id = -1, master=None, cnf={}, **kw): Canvas.__init__(self, master=master, cnf=cnf, **kw) self.master = master self.img_id = img_id self.preview_id = preview_id imgfile = Image.open(PATH_BLANK_PICTURE) resized = imgfile.resize(SIZE_PREVIEW, Image.ANTIALIAS) self.imgtk = ImageTk.PhotoImage(resized) imgfile.close() self.create_image(0, 0, image=self.imgtk, tags = "IMG") self.configure(scrollregion= (-(w//2), -(h//2), (w//2), (h//2))) self.id_viewer = Label(self, text=str(preview_id), font = ("serif", 20), fg='red', bg='white') self.id_viewer.pack() self.create_window(w//2 - 10, h//2 - 10, window=self.id_viewer)
def __init__(self, parent=None, width=200, height=200, background="pink"): """ Initialisation parent : le parent dans l'application background : fond d'ecran """ self.width = width self.height = height Canvas.__init__(self, width=self.width, height=self.height, background=background) self.parent = parent # Signal X-Y self.signal_XY = None self.signal_XY_liste = [] self.color_XY = "green" self.signal_XY_allowed = 0;
def __init__(self, parent, top, lmap): """Constructor. Initialises class attributes, calls drawMap. parent = mapcontainer created in Gui. Ref to Gui (top) supplied in case needed for future use.""" Canvas.__init__(self, parent, width=512, height=512) # Bind drag and drop events to canvas and pack it in mapcontainer self.bind('<ButtonPress-1>', self.grab) self.bind('<ButtonRelease-1>', self.drop) self.bind('<B1-Motion>', self.drag) self.pack(side='left', fill=BOTH, expand=1) self.xpos = 0 # X coord of mouse grab event self.ypos = 0 # Y coord of mouse grab event self.scale = 1 # Current zoom level self.im = None # Ref to original image, on which zoom is based self.original = None # image id, as first added to canvas self.zoomed = None # image id, as zoomed on canvas self.lmap = lmap self.drawMap(lmap)
def __init__(self, master, tone_width=KEY_WIDTH): Canvas.__init__(self, master, background='gray', height=SCALE_PLOT_HEIGHT, highlightthickness=0) self.tone_width = tone_width self.offset = int(tone_width / 2) self.min_tone = MIN_TONE self.max_tone = MAX_TONE self.scales = {} for width in range(16, 1, -2): color = "gray%i" % (20 + 3 * width) self.draw_scale(scales.EvenTempered(528), color=color, width=width, add_to_scales=False) self.tones = {} self.events = [] self.running = True self.consume()
def __init__(self, parent): Canvas.__init__(self, parent) self.gpio_pins = CM.hardware.gpio_pins self.gpiolen = CM.hardware.gpio_len self.pwm_max = CM.hardware.pwm_range self.gpioactive = hc._GPIOACTIVE self.is_pin_pwm = hc.is_pin_pwm self.gpio = list() self.state = list() self.channels = [_ for _ in range(self.gpiolen)] self.channel_keys = CM.network.channels.keys() self.network = hc.network self.red = "#FF0000" self.green = "#00FF00" self.blue = "#0000FF" self.white = "#FFFFFF" self.black = "#000000" self.parent = parent self.init_ui() self.tkinter_function()
def __init__(self, parent): Canvas.__init__(self, parent) self.gpio_pins = CM.hardware.gpio_pins self.gpio_len = CM.hardware.gpio_len self.pwm_max = CM.hardware.pwm_range self.gpio_active = hc._GPIOACTIVE self.is_pin_pwm = hc.is_pin_pwm self.gpio = list() self.state = list() self.channels = [_ for _ in range(self.gpio_len)] self.channel_keys = CM.network.channels.keys() self.network = hc.network self.red = "#FF0000" self.green = "#00FF00" self.blue = "#0000FF" self.white = "#FFFFFF" self.black = "#000000" self.parent = parent self.init_ui() self.tkinter_function()
def __init__(self, parent, x_coord, y_coord, radius, scale): Canvas.__init__(self, parent, relief=RAISED, borderwidth=2, bg="grey", width=(radius + x_coord / 2) * scale * 2, height=(radius + y_coord / 2) * scale * 2) self.parent = parent self.scale = scale self.radius = radius * scale self.xcenter = x_coord + self.radius self.ycenter = y_coord + self.radius self.ledradius = 2 * scale self.ledcolor = [] self.ledxy = [] self.led = [] positions = [ 75, 45, 15, 270 + 75, 270 + 45, 270 + 15, 180 + 75, 180 + 45, 180 + 15, 90 + 75, 90 + 45, 90 + 15 ] colors = [ "green", "green", "red", "red", "green", "green", "red", "red", "green", "green", "red", "red" ] idx = 0 for i in positions: p = math.radians(i) xy = (math.cos(p) * self.radius + self.xcenter, self.ycenter - math.sin(p) * self.radius) self.ledcolor.append(colors[idx]) self.ledxy.append(xy) self.led.append( self.create_oval(xy[0] - self.ledradius, xy[1] - self.ledradius, xy[0] + self.ledradius, xy[1] + self.ledradius, outline="black", width=1)) idx += 1
def __init__(self, master, font, row_height, row_minwidth, hover_background=None, background=None, anchor=None, onclick=None): Canvas.__init__(self, master, bd=0, highlightthickness=0, yscrollincrement=row_height, width=0) if background is not None: self.configure(background=background) self._frame_of_row_numbers = Frame(self, bd=0) self.create_window(0, 0, window=self._frame_of_row_numbers, anchor=N + W) self._width_of_row_numbers = 0 self._labelrow_kwargs = labelrow_kwargs = {} labelrow_kwargs["font"] = font if anchor is not None: labelrow_kwargs["anchor"] = anchor self._row_minwidth = row_minwidth self._row_height = row_height self._hover_background = hover_background self._onclick = onclick self._number_of_labels = 0
def __init__(self, master, layout, margin=20, **kw): Canvas.__init__(self, master, width=layout.size.x + 2 * margin, height=layout.size.y + 2 * margin, **kw) self.__margin = margin self._vertex_label_mode = "auto" # map value -> Vertex object self._vertices = dict() self._layout = layout self._picked_vertex_state = PickedState() self._create_vertex_shape = ( lambda vertex: shapes.create_default_shape(self, vertex)) self.update() # self._translate = (0, 0) self._mouse_plugin = MousePlugin().apply(self) # makes vertex shape change appearing if it was picked # also sets layout lock for picked vertices def createListener(): state = self._picked_vertex_state layout = self.layout def listener(vertex): picked = state.is_picked(vertex) vertex.shape.set_selection(picked) layout.set_lock(layout.graph.index(vertex.value), picked) return listener self._picked_vertex_state.add_listener(createListener()) # handle resize self.bind("<Configure>", lambda event: self._update_layout_size())
def __init__(self, master, layout, margin=20, caption=None, **kw): Canvas.__init__(self, master, width=int(layout.size.x + 2 * margin), height=int(layout.size.y + 2 * margin), **kw) self.__margin = margin self._vertex_label_mode = "auto" # map value -> Vertex object self._vertices = dict() self._layout = layout self._picked_vertex_state = PickedState() self._create_vertex_shape = (lambda vertex: shapes.create_default_shape(self, vertex)) self.update() self._caption = self.create_caption(caption) if caption else None # self._translate = (0, 0) self._mouse_plugin = MousePlugin().apply(self) # makes vertex shape change appearing if it was picked # also sets layout lock for picked vertices def createListener(): state = self._picked_vertex_state layout = self.layout def listener(vertex): picked = state.is_picked(vertex) vertex.shape.set_selection(picked) layout.set_lock(layout.graph.index(vertex.value), picked) return listener self._picked_vertex_state.add_listener(createListener()) # handle resize self.bind("<Configure>", lambda event: self._on_configure())
def __init__(self, master, image): self.height_ratio = 1 width, height = image.size pixels = image.load() RED, GREEN, BLUE = range(3) self.colors = ['#{0:02x}{1:02x}{2:02x}'.format( contrast(sum(pixels[x, y][RED] for x in xrange(width)) / width), contrast(sum(pixels[x, y][GREEN] for x in xrange(width)) / width), contrast(sum(pixels[x, y][BLUE] for x in xrange(width)) / width)) for y in xrange(height)] if height / float(width) > 1.5: width *= 2 elif width < 200: width *= 2 height *= 2 self.height_ratio = 2 if (width, height) != image.size: image = image.resize((width, height)) Canvas.__init__(self, master, width=width, height=height) self.tk_img = ImageTk.PhotoImage(image) self.update_image() self.pack()
def __init__(self, *args, **kwargs): self.world = kwargs["world"] del kwargs["world"] Canvas.__init__(self, *args, **kwargs) #TODO: make the following dynamic self.anglespan = 260 self.field_length = 6.0 self.field_width = 4.0 self.field_radius = 0.5 self.field_margin = 1.0 self.goal_depth = 0.2 self.goal_width = 0.7 self.thickness = 1 self.has_field = False self['bg'] = FIELD_GREEN self['width'] = 100 * (self.field_length + 2 * self.field_margin) self['height'] = 100 * (self.field_width + 2 * self.field_margin) self.robots = {} self.balls = {} self.fps = self.create_text(50, 20, fill=BLACK)
def __init__(self,parent,**kwargs): Canvas.__init__(self,parent,**kwargs) self.pack() self.focus_set() self.parent = parent # self.height = self.winfo_reqheight() # self.width = self.winfo_reqwidth() self.bind('<Left>', self.parent.display_prev_image) self.bind('<Right>', self.parent.display_next_image) self.bind('<Up>', self.parent.display_first_image) self.bind('<Down>', self.parent.display_last_image) self.bind('q', self.parent.exit_mainloop) self.bind('<Button-1>',self.scroll_start) self.bind('<B1-Motion>',self.scroll_move) # shift image by 1 pixel self.bind('<Shift-Up>', func=lambda crd: self.scroll_from_keyboard(Coordinate( 0,-1))) self.bind('<Shift-Down>', func=lambda crd: self.scroll_from_keyboard(Coordinate( 0, 1))) self.bind('<Shift-Left>', func=lambda crd: self.scroll_from_keyboard(Coordinate(-1, 0))) self.bind('<Shift-Right>', func=lambda crd: self.scroll_from_keyboard(Coordinate( 1, 0))) # shift image by 8 pixels self.bind('<Control-Up>', func=lambda crd: self.scroll_from_keyboard(Coordinate( 0,-8))) self.bind('<Control-Down>', func=lambda crd: self.scroll_from_keyboard(Coordinate( 0, 8))) self.bind('<Control-Left>', func=lambda crd: self.scroll_from_keyboard(Coordinate(-8, 0))) self.bind('<Control-Right>', func=lambda crd: self.scroll_from_keyboard(Coordinate( 8, 0)))
def __init__(self, master, font, row_height, row_minwidth, hover_background=None, background=None, anchor=None, onclick=None): Canvas.__init__(self, master, bd=0, highlightthickness=0, yscrollincrement=row_height, width=0) if background is not None: self.configure(background=background) self._frame_of_row_numbers = Frame(self, bd=0) self.create_window(0, 0, window=self._frame_of_row_numbers, anchor=N+W) self._width_of_row_numbers = 0 self._labelrow_kwargs = labelrow_kwargs= {} labelrow_kwargs["font"] = font if anchor is not None: labelrow_kwargs["anchor"] = anchor self._row_minwidth= row_minwidth self._row_height = row_height self._hover_background = hover_background self._onclick = onclick self._number_of_labels = 0
def __init__(self,parent,dictionary,rootNode,buttonWidth,buttonHeight,buttonPadX,buttonPadY,font,fontSize): sr = self.calculateDimensions(dictionary,buttonWidth,buttonHeight,buttonPadX,buttonPadY) Canvas.__init__(self, parent,scrollregion=sr) self.addButtons(dictionary,rootNode,buttonWidth,buttonHeight,buttonPadX,buttonPadY,font,fontSize)
def __init__(self): Canvas.__init__(self, width=WIDTH, height=HEIGHT, background="white", highlightthickness=0) self.initInfoScreen() self.pack()
def __init__(self, master): Canvas.__init__(self, master, height=222, width=400, bg="black") self.create() self.pack(side=LEFT)
def __init__(self, graph): Canvas.__init__(self, graph) self.config(width=gconfig["info-area-width"], height=gconfig["graph-height"], background=gconfig["info-fill"]) self._current_info_text = ''
def __init__(self, dim, **kwargs): self.dim = dim self.space = space Canvas.__init__(self, **kwargs) self.prepare_mesh()
def __init__(self, parent, **kwargs): Canvas.__init__(self, parent, **kwargs) self.raffle = list() self.items = list()
def __init__(self, master, from_color, to_color, width=None, height=None, orient=HORIZONTAL, steps=None, **kwargs): Canvas.__init__(self, master, **kwargs) if steps is None: if orient == HORIZONTAL: steps = height else: steps = width if isinstance(from_color, basestring): from_color = hex2rgb(from_color) if isinstance(to_color, basestring): to_color = hex2rgb(to_color) r, g, b = from_color dr = float(to_color[0] - r) / steps dg = float(to_color[1] - g) / steps db = float(to_color[2] - b) / steps if orient == HORIZONTAL: if height is None: raise ValueError("height can not be None") self.configure(height=height) if width is not None: self.configure(width=width) img_height = height img_width = self.winfo_screenwidth() image = Image.new("RGB", (img_width, img_height), "#FFFFFF") draw = ImageDraw.Draw(image) for i in range(steps): r, g, b = r + dr, g + dg, b + db y0 = int(float(img_height * i) / steps) y1 = int(float(img_height * (i + 1)) / steps) draw.rectangle((0, y0, img_width, y1), fill=(int(r), int(g), int(b))) else: if width is None: raise ValueError("width can not be None") self.configure(width=width) if height is not None: self.configure(height=height) img_height = self.winfo_screenheight() img_width = width image = Image.new("RGB", (img_width, img_height), "#FFFFFF") draw = ImageDraw.Draw(image) for i in range(steps): r, g, b = r + dr, g + dg, b + db x0 = int(float(img_width * i) / steps) x1 = int(float(img_width * (i + 1)) / steps) draw.rectangle((x0, 0, x1, img_height), fill=(int(r), int(g), int(b))) self._gradient_photoimage = ImageTk.PhotoImage(image) self.create_image(0, 0, anchor=NW, image=self._gradient_photoimage)
def __init__(self, master, from_color, to_color, width=None, height=None, orient=HORIZONTAL, steps=None, **kwargs): Canvas.__init__(self, master, **kwargs) if steps is None: if orient == HORIZONTAL: steps = height else: steps = width if isinstance(from_color, basestring): from_color = hex2rgb(from_color) if isinstance(to_color, basestring): to_color = hex2rgb(to_color) r,g,b = from_color dr = float(to_color[0] - r)/steps dg = float(to_color[1] - g)/steps db = float(to_color[2] - b)/steps if orient == HORIZONTAL: if height is None: raise ValueError("height can not be None") self.configure(height=height) if width is not None: self.configure(width=width) img_height = height img_width = self.winfo_screenwidth() image = Image.new("RGB", (img_width, img_height), "#FFFFFF") draw = ImageDraw.Draw(image) for i in range(steps): r,g,b = r+dr, g+dg, b+db y0 = int(float(img_height * i)/steps) y1 = int(float(img_height * (i+1))/steps) draw.rectangle((0, y0, img_width, y1), fill=(int(r),int(g),int(b))) else: if width is None: raise ValueError("width can not be None") self.configure(width=width) if height is not None: self.configure(height=height) img_height = self.winfo_screenheight() img_width = width image = Image.new("RGB", (img_width, img_height), "#FFFFFF") draw = ImageDraw.Draw(image) for i in range(steps): r,g,b = r+dr, g+dg, b+db x0 = int(float(img_width * i)/steps) x1 = int(float(img_width * (i+1))/steps) draw.rectangle((x0, 0, x1, img_height), fill=(int(r),int(g),int(b))) self._gradient_photoimage = ImageTk.PhotoImage(image) self.create_image(0, 0, anchor=NW, image=self._gradient_photoimage)
def __init__(self, *args, **kwargs): Canvas.__init__(self, *args, **kwargs) self.twidget = None self.config(bg='#000', highlightbackground='#000', height=3)
def __init__(self, parent, **kwargs): Canvas.__init__(self, parent, **kwargs) self.bind("<Configure>", self.on_resize) self.height = self.winfo_reqheight() self.width = self.winfo_reqwidth()
def __init__(self, parent): Canvas.__init__(self, parent) self.configure_() self.place_()
def __init__(self, master): Canvas.__init__(self, master, bg='gray', width=PIXELS, height=PIXELS) self.bind('<Button-1>', self.left_click) self.route = None
def __init__(self,parent): Canvas.__init__(self, width = Display_width,height=Display_height,background = 'white', highlightthickness=0) self.parent = parent self.pack()
def __init__(self, parent, **kwargs): Canvas.__init__(self, parent, **kwargs) self.bind("<Configure>", self.on_resize)