当前位置: 首页 > news >正文

个人做网站语言电商从零基础怎么学

个人做网站语言,电商从零基础怎么学,cgi做网站,没备案的网站可以做淘客在简单的界面设计中,Notebook也是常用的组件之一,Notebook组件的引入可以根据标签来切换不同的界面。使得界面更有层次感,不必都挤在一个界面上。在tkinter中就有Notebook组件,在ttkbootstrap中,同样也对Notebook进行了…

        在简单的界面设计中,Notebook也是常用的组件之一,Notebook组件的引入可以根据标签来切换不同的界面。使得界面更有层次感,不必都挤在一个界面上。在tkinter中就有Notebook组件,在ttkbootstrap中,同样也对Notebook进行了引入并做了对应的美化。

一:Notebook接口

查看Notebook的接口可以通过help来看

print(help(ttk.Notebook))
Help on class Notebook in module tkinter.ttk:class Notebook(Widget)|  Notebook(*args, **kwargs)||  Ttk Notebook widget manages a collection of windows and displays|  a single one at a time. Each child window is associated with a tab,|  which the user may select to change the currently-displayed window.||  Method resolution order:|      Notebook|      Widget|      tkinter.Widget|      tkinter.BaseWidget|      tkinter.Misc|      tkinter.Pack|      tkinter.Place|      tkinter.Grid|      builtins.object||  Methods defined here:||  __init__(self, *args, **kwargs)||  add(self, child, **kw)|      Adds a new tab to the notebook.||      If window is currently managed by the notebook but hidden, it is|      restored to its previous position.||  config = configure(self, cnf=None, **kwargs)||  configure(self, cnf=None, **kwargs)||  enable_traversal(self)|      Enable keyboard traversal for a toplevel window containing|      this notebook.||      This will extend the bindings for the toplevel window containing|      this notebook as follows:||          Control-Tab: selects the tab following the currently selected|                       one||          Shift-Control-Tab: selects the tab preceding the currently|                             selected one||          Alt-K: where K is the mnemonic (underlined) character of any|                 tab, will select that tab.||      Multiple notebooks in a single toplevel may be enabled for|      traversal, including nested notebooks. However, notebook traversal|      only works properly if all panes are direct children of the|      notebook.||  forget(self, tab_id)|      Removes the tab specified by tab_id, unmaps and unmanages the|      associated window.||  hide(self, tab_id)|      Hides the tab specified by tab_id.||      The tab will not be displayed, but the associated window remains|      managed by the notebook and its configuration remembered. Hidden|      tabs may be restored with the add command.
...
...
...

通过dir来查看Notebook支持的属性和方法

['_Misc__winfo_getint', '_Misc__winfo_parseitem', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_bind', '_configure', '_displayof', '_do', '_getboolean', '_getconfigure', '_getconfigure1', '_getdoubles', '_getints', '_grid_configure', '_gridconvvalue', '_last_child_ids', '_nametowidget', '_noarg_', '_options', '_register', '_report_exception', '_root', '_setup', '_subst_format', '_subst_format_str', '_substitute', '_tclCommands', '_unbind', '_windowingsystem', 'add', 'after', 'after_cancel', 'after_idle', 'anchor', 'bbox', 'bell', 'bind', 'bind_all', 'bind_class', 'bindtags', 'cget', 'clipboard_append', 'clipboard_clear', 'clipboard_get', 'columnconfigure', 'config', 'configure', 'deletecommand', 'destroy', 'enable_traversal', 'event_add', 'event_delete', 'event_generate', 'event_info', 'focus', 'focus_displayof', 'focus_force', 'focus_get', 'focus_lastfor', 'focus_set', 'forget', 'getboolean', 'getdouble', 'getint', 'getvar', 'grab_current', 'grab_release', 'grab_set', 'grab_set_global', 'grab_status', 'grid', 'grid_anchor', 'grid_bbox', 'grid_columnconfigure', 'grid_configure', 'grid_forget', 'grid_info', 'grid_location', 'grid_propagate', 'grid_remove', 'grid_rowconfigure', 'grid_size', 'grid_slaves', 'hide', 'identify', 'image_names', 'image_types', 'index', 'info', 'info_patchlevel', 'insert', 'instate', 'keys', 'lift', 'location', 'lower', 'mainloop', 'nametowidget', 'option_add', 'option_clear', 'option_get', 'option_readfile', 'pack', 'pack_configure', 'pack_forget', 'pack_info', 'pack_propagate', 'pack_slaves', 'place', 'place_configure', 'place_forget', 'place_info', 'place_slaves', 'propagate', 'quit', 'register', 'rowconfigure', 'select', 'selection_clear', 'selection_get', 'selection_handle', 'selection_own', 'selection_own_get', 'send', 'setvar', 'size', 'slaves', 'state', 'tab', 'tabs', 'tk_bisque', 'tk_focusFollowsMouse', 'tk_focusNext', 'tk_focusPrev', 'tk_setPalette', 'tk_strictMotif', 'tkraise', 'unbind', 'unbind_all', 'unbind_class', 'update', 'update_idletasks', 'wait_variable', 'wait_visibility', 'wait_window', 'waitvar', 'winfo_atom', 'winfo_atomname', 'winfo_cells', 'winfo_children', 'winfo_class', 'winfo_colormapfull', 'winfo_containing', 'winfo_depth', 'winfo_exists', 'winfo_fpixels', 'winfo_geometry', 'winfo_height', 'winfo_id', 'winfo_interps', 'winfo_ismapped', 'winfo_manager', 'winfo_name', 'winfo_parent', 'winfo_pathname', 'winfo_pixels', 'winfo_pointerx', 'winfo_pointerxy', 'winfo_pointery', 'winfo_reqheight', 'winfo_reqwidth', 'winfo_rgb', 'winfo_rootx', 'winfo_rooty', 'winfo_screen', 'winfo_screencells', 'winfo_screendepth', 'winfo_screenheight', 'winfo_screenmmheight', 'winfo_screenmmwidth', 'winfo_screenvisual', 'winfo_screenwidth', 'winfo_server', 'winfo_toplevel', 'winfo_viewable', 'winfo_visual', 'winfo_visualid', 'winfo_visualsavailable', 'winfo_vrootheight', 'winfo_vrootwidth', 'winfo_vrootx', 'winfo_vrooty', 'winfo_width', 'winfo_x', 'winfo_y']

二:Notebook创建

import ttkbootstrap as ttk
from ttkbootstrap.constants import *root = ttk.Window(  title="主窗口",        #设置窗口的标题themename="yeti",     #设置主题yetisize=(400,200),        #窗口的大小)nb = ttk.Notebook()
nb.pack(fill=BOTH, expand=True)b1 = ttk.Button(nb, text="solid", bootstyle="info-solid")
b1.pack(side=LEFT, padx=5, pady=10)
nb.add(b1, text='选项卡1')b2 = ttk.Button(nb, text="outline", bootstyle="warning-outline")
b2.pack(side=LEFT, padx=5, pady=10)
nb.add(b2, text='选项卡2')root.mainloop()

可以看到创建了一个Notebook,加入了两个标签页,每个标签页中放一个按钮,上面是一个最基本的创建Notebook的用例,ttk.Notebook也有很多参数

原始链接:tkinter.ttk — Tk themed widgets — Python 3.12.2 documentation

三:Notebook主题

Notebook可以用自带的主题,也可以自己定制主题

nb = ttk.Notebook(root, bootstyle=SUCCESS)

定制主题如下

import ttkbootstrap as ttk
from ttkbootstrap.constants import *root = ttk.Window(  title="主窗口",        #设置窗口的标题themename="yeti",     #设置主题yetisize=(400,200),        #窗口的大小)s = ttk.Style()
s.configure('Custom.TNotebook', foreground='pink', background='yellow', borderwidth=10)
s.configure('Custom.TNotebook.Tab', foreground='blue', background='orange', borderwidth=10)
s.map('Custom.TNotebook.Tab', foreground=[('selected', 'red')], background=[('selected', 'blue')])nb = ttk.Notebook(root,style='Custom.TNotebook')
nb.pack(fill=BOTH, expand=True)b1 = ttk.Button(nb, text="solid", bootstyle="info-solid")
b1.pack(side=LEFT, padx=5, pady=10)
nb.add(b1, text='选项卡1')b2 = ttk.Button(nb, text="outline", bootstyle="warning-outline")
b2.pack(side=LEFT, padx=5, pady=10)
nb.add(b2, text='选项卡2')root.mainloop()

http://www.tj-hxxt.cn/news/29180.html

相关文章:

  • 网站备案地址不是我的地址怎么办yy直播
  • iis添加网站ip地址手机如何制作一个网页链接
  • 哪家企业做网站好采集站seo提高收录
  • 仿同程网 连锁酒店 网站模板怎样做一个产品营销方案
  • 文字图片制作网站seo优化有百度系和什么
  • 深圳网页设计制作网站佛山全市核酸检测
  • 企业需求做网站在哪儿交易武汉搜索引擎排名优化
  • 德州市建设街小学官方网站5g网络优化
  • 广州网站开发设计平台seo诊断分析在线工具
  • 展馆网站建设网络营销的应用研究论文
  • 网站想自己做怎么弄外链价格
  • 外贸网站建设哪家有名软文范例100字
  • 做网站测试 怎么兼容ie9小时seo百度关键词点击器
  • 外包建站公司营销网点机构号
  • 怎么做网站关键字seo技术培训茂名
  • vps能同时做网站同时做其它事吗网络搜索引擎有哪些
  • 西安短视频代运营北京seo公司工作
  • 广州网站建设求职简历网络营销方案设计
  • 哪里的网站建设如何在各大网站发布信息
  • 中山市两学一做网站百度搜索关键词排名靠前
  • 站长之家综合查询工具搜索引擎排名优化程序
  • 设备上哪个网站做外贸推广seo网络优化是什么意思
  • alexa全球网站排名百度指数的数值代表什么
  • 黄石做网站联系今日军事新闻头条最新
  • 做直销网站自己有产品怎么网络销售
  • 开发公司副总经理岗位职责汕头seo优化
  • 在线手机网站制作百度推广怎么优化排名
  • 网站301如何做今日新闻最新头条10条摘抄
  • 网站可以做系统吗上海seo排名
  • 17网站一起做网店如何下单刷排名seo软件