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


Python Tk.bell方法代码示例

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


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

示例1: test_tabs

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import bell [as 别名]
def test_tabs():
    a = Tk()
    n = Notebook( a, TOP )

    # uses the Notebook's frame
    f1 = Frame( n() )
    b1 = Button( f1, text="Ignore me" )
    e1 = Entry( f1 )
    # pack your widgets before adding the frame 
    # to the Notebook (but not the frame itself)!
    b1.pack( fill=BOTH, expand=1 )
    e1.pack( fill=BOTH, expand=1 )

    # keeps the reference to the radiobutton (optional)
    x1 = n.add_screen( f1, "Tab 1" )

    f2 = Frame( n() )
    # this button destroys the 1st screen radiobutton
    b2 = Button( f2, text='Remove Tab 1', command=lambda:x1.destroy() )
    b3 = Button( f2, text='Beep...', command=lambda:Tk.bell( a ) )
    b2.pack( fill=BOTH, expand=1 )
    b3.pack( fill=BOTH, expand=1 )

    f3 = Frame( n() )


    n.add_screen( f2, "Tab 2" )
    n.add_screen( f3, "Minimize" )
    a.mainloop()
开发者ID:hardbyte,项目名称:scipy-sim,代码行数:31,代码来源:tabs.py

示例2: Cap

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import bell [as 别名]

#.........这里部分代码省略.........
			self.video.close()
			self.video = None

	def restart_video(self, *args):
		' restart video (if device changes or hangs) '
		self.do_stop_video()
		self.root.after(1, self.do_start_video)

	def do_start_video(self, *args):
		' init video and start live view '
		if self.video is None:
			self.video = Video_device(self.videodevice.get())
			_, _, self.fourcc = self.video.get_format()
			caps = sorted(self.video.get_framesizes(self.fourcc), cmp=lambda a, b: cmp(a['size_x']*a['size_y'], b['size_x']*b['size_y']))
			self.previewsize, self.highressize = caps[0], caps[-1]
			self.previewsize['size_x'], self.previewsize['size_y'] = self.video.set_format(
				self.previewsize['size_x'], self.previewsize['size_y'], 0, 'MJPEG')
			try: self.video.set_auto_white_balance(True)
			except: pass
			try: self.video.set_exposure_auto(True)
			except: pass
			try: self.video.set_focus_auto(True)
			except: pass
			self.video.create_buffers(30)
			self.video.queue_all_buffers()
			self.video.start()
			self.root.after(1, self.do_live_view)
			#self.x_canvas.config(width=640, height=480)
			#self.x_canvas.pack(side='top')
			self.degree.set(0)

	def do_live_view(self, *args):
		' show single pic live view and ask tk to call us again later '
		if self.video is not None:
			select((self.video, ), (), ())
			data = self.video.read_and_queue()
			self.image = frombytes('RGB', (self.previewsize['size_x'], self.previewsize['size_y']), data)
			if self.invert.get():
				self.image = invert(self.image)
			if self.grayscale.get():
				self.image = grayscale(self.image)
			if self.autocontrast.get():
				self.image = autocontrast(self.image)
			if self.equalize.get():
				self.image = equalize(self.image)
			if self.solarize.get():
				self.image = solarize(self.image)
			if self.degree.get():
				self.image = self.image.rotate(self.degree.get())
			self.photo = PhotoImage(self.image)
			self.x_canvas.create_image(640/2, 640/2, image=self.photo)
			self.root.after(3, self.do_live_view)

	def do_single_shot(self, *args):
		' do a high res single shot and store it '
		def _go():
			self.video = Video_device(self.videodevice.get())
			try:
				self.highressize['size_x'], self.highressize['size_y'] = self.video.set_format(
					self.highressize['size_x'], self.highressize['size_y'], 0, 'MJPEG')
				try: self.video.set_auto_white_balance(True)
				except: pass
				try: self.video.set_exposure_auto(True)
				except: pass
				try: self.video.set_focus_auto(True)
				except: pass
				self.video.create_buffers(7)
				self.video.queue_all_buffers()
				self.video.start()
				stop_time = time() + 3.0
				# wait for auto
				while stop_time >= time():
					select((self.video, ), (), ())
					self.update_idletasks()
					data = self.video.read_and_queue()
				image = frombytes('RGB', (self.highressize['size_x'], self.highressize['size_y'], ), data)
				if self.invert.get():
					image = invert(image)
				if self.grayscale.get():
					image = grayscale(image)
				if self.autocontrast.get():
					image = autocontrast(image)
				if self.equalize.get():
					self.image = equalize(self.image)
				if self.solarize.get():
					self.image = solarize(self.image)
				if self.degree.get():
					image = image.rotate(self.degree.get())
				image.save(self.filename.get())
				self.inc_picture()
				self.root.bell()
				self.video.stop()
			finally:
				self.video.close()
				self.video = None
			self.root.after(1, self.do_start_video)
		self.do_stop_video()
		self.set_pauseimage()
		self.update_idletasks()
		self.root.after(1, _go)
开发者ID:JimmyDurandWesolowski,项目名称:python-v4l2capture,代码行数:104,代码来源:filmroller.py

示例3: NvimTk

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import bell [as 别名]

#.........这里部分代码省略.........
        self._tk_tag_region('move', move_top, move_bot, left, right)
        self._canvas.move('move', 0, -count * self._rowsize)
        self._canvas.dtag('move', 'move')
        # self._tk_fill_region(fill_top, fill_bot, left, right)

    def _tk_nvim_highlight_set(self, attrs):
        self._attrs = attrs

    def _tk_nvim_put(self, data):
        # choose a Font instance
        font = self._fnormal
        if self._attrs.get('bold', False):
            font = self._fbold
        if self._attrs.get('italic', False):
            font = self._fbolditalic if font == self._fbold else self._fitalic
        # colors
        fg = "#{0:0{1}x}".format(self._attrs.get('foreground', self._fg), 6)
        bg = "#{0:0{1}x}".format(self._attrs.get('background', self._bg), 6)
        # get the "text" and "rect" which correspond to the current cell
        x, y = self._tk_get_coords(self._cursor_row, self._cursor_col)
        items = self._canvas.find_overlapping(x, y, x + 1, y + 1)
        if len(items) != 2:
            # caught part the double-width character in the cell to the left,
            # filter items which dont have the same horizontal coordinate as
            # "x"
            predicate = lambda item: self._canvas.coords(item)[0] == x
            items = filter(predicate, items)
        # rect has lower id than text, sort to unpack correctly
        rect, text = sorted(items)
        self._canvas.itemconfig(text, fill=fg, font=font, text=data or ' ')
        self._canvas.itemconfig(rect, fill=bg)
        self._tk_nvim_cursor_goto(self._cursor_row, self._cursor_col + 1)

    def _tk_nvim_bell(self):
        self._root.bell()

    def _tk_nvim_update_fg(self, fg):
        self._fg = "#{0:0{1}x}".format(fg, 6)

    def _tk_nvim_update_bg(self, bg):
        self._bg = "#{0:0{1}x}".format(bg, 6)

    def _tk_redraw_canvas(self, width, height):
        if self._canvas:
            self._canvas.destroy()
        self._fnormal = Font(family='Monospace', size=13)
        self._fbold = Font(family='Monospace', weight='bold', size=13)
        self._fitalic = Font(family='Monospace', slant='italic', size=13)
        self._fbolditalic = Font(family='Monospace', weight='bold',
                                 slant='italic', size=13)
        self._colsize = self._fnormal.measure('A')
        self._rowsize = self._fnormal.metrics('linespace')
        self._canvas = Canvas(self._root, width=self._colsize * width,
                              height=self._rowsize * height)
        self._tk_fill_region(0, height - 1, 0, width - 1)
        self._cursor_row = 0
        self._cursor_col = 0
        self._scroll_top = 0
        self._scroll_bot = height - 1
        self._scroll_left = 0
        self._scroll_right = width - 1
        self._width, self._height = (width, height,)
        self._canvas.pack()

    def _tk_fill_region(self, top, bot, left, right):
        # create columns from right to left so the left columns have a
开发者ID:timeyyy,项目名称:pytknvim,代码行数:70,代码来源:tarruda.py


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