Server IP : 103.119.228.120 / Your IP : 3.129.63.252 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/lib64/python2.7/Demo/tkinter/ttk/ |
Upload File : |
"""This demonstrates good part of the syntax accepted by theme_create. This is a translation of plastik.tcl to python. You will need the images used by the plastik theme to test this. The images (and other tile themes) can be retrived by doing: $ cvs -z3 -d:pserver:anonymous@tktable.cvs.sourceforge.net:/cvsroot/tktable \ co tile-themes To test this module you should do, for example: import Tkinter import plastik_theme root = Tkinter.Tk() plastik_theme.install(plastik_image_dir) ... Where plastik_image_dir contains the path to the images directory used by the plastik theme, something like: tile-themes/plastik/plastik """ import os import glob import ttk from Tkinter import PhotoImage __all__ = ['install'] colors = { "frame": "#efefef", "disabledfg": "#aaaaaa", "selectbg": "#657a9e", "selectfg": "#ffffff" } imgs = {} def _load_imgs(imgdir): imgdir = os.path.expanduser(imgdir) if not os.path.isdir(imgdir): raise Exception("%r is not a directory, can't load images" % imgdir) for f in glob.glob("%s/*.gif" % imgdir): img = os.path.split(f)[1] name = img[:-4] imgs[name] = PhotoImage(name, file=f, format="gif89") def install(imgdir): _load_imgs(imgdir) style = ttk.Style() style.theme_create("plastik", "default", settings={ ".": { "configure": {"background": colors['frame'], "troughcolor": colors['frame'], "selectbackground": colors['selectbg'], "selectforeground": colors['selectfg'], "fieldbackground": colors['frame'], "font": "TkDefaultFont", "borderwidth": 1}, "map": {"foreground": [("disabled", colors['disabledfg'])]} }, "Vertical.TScrollbar": {"layout": [ ("Vertical.Scrollbar.uparrow", {"side": "top", "sticky": ''}), ("Vertical.Scrollbar.downarrow", {"side": "bottom", "sticky": ''}), ("Vertical.Scrollbar.uparrow", {"side": "bottom", "sticky": ''}), ("Vertical.Scrollbar.trough", {"sticky": "ns", "children": [("Vertical.Scrollbar.thumb", {"expand": 1, "unit": 1, "children": [("Vertical.Scrollbar.grip", {"sticky": ''})] })] })] }, "Horizontal.TScrollbar": {"layout": [ ("Horizontal.Scrollbar.leftarrow", {"side": "left", "sticky": ''}), ("Horizontal.Scrollbar.rightarrow", {"side": "right", "sticky": ''}), ("Horizontal.Scrollbar.leftarrow", {"side": "right", "sticky": ''}), ("Horizontal.Scrollbar.trough", {"sticky": "ew", "children": [("Horizontal.Scrollbar.thumb", {"expand": 1, "unit": 1, "children": [("Horizontal.Scrollbar.grip", {"sticky": ''})] })] })] }, "TButton": { "configure": {"width": 10, "anchor": "center"}, "layout": [ ("Button.button", {"children": [("Button.focus", {"children": [("Button.padding", {"children": [("Button.label", {"side": "left", "expand": 1})] })] })] }) ] }, "Toolbutton": { "configure": {"anchor": "center"}, "layout": [ ("Toolbutton.border", {"children": [("Toolbutton.button", {"children": [("Toolbutton.padding", {"children": [("Toolbutton.label", {"side":"left", "expand":1})] })] })] }) ] }, "TMenubutton": {"layout": [ ("Menubutton.button", {"children": [("Menubutton.indicator", {"side": "right"}), ("Menubutton.focus", {"children": [("Menubutton.padding", {"children": [("Menubutton.label", {"side": "left", "expand": 1})] })] })] })] }, "TNotebook": {"configure": {"tabmargins": [0, 2, 0, 0]}}, "TNotebook.tab": { "configure": {"padding": [6, 2, 6, 2], "expand": [0, 0, 2]}, "map": {"expand": [("selected", [1, 2, 4, 2])]} }, "Treeview": {"configure": {"padding": 0}}, # elements "Button.button": {"element create": ("image", 'button-n', ("pressed", 'button-p'), ("active", 'button-h'), {"border": [4, 10], "padding": 4, "sticky":"ewns"} ) }, "Toolbutton.button": {"element create": ("image", 'tbutton-n', ("selected", 'tbutton-p'), ("pressed", 'tbutton-p'), ("active", 'tbutton-h'), {"border": [4, 9], "padding": 3, "sticky": "news"} ) }, "Checkbutton.indicator": {"element create": ("image", 'check-nu', ('active', 'selected', 'check-hc'), ('pressed', 'selected', 'check-pc'), ('active', 'check-hu'), ("selected", 'check-nc'), {"sticky": ''} ) }, "Radiobutton.indicator": {"element create": ("image", 'radio-nu', ('active', 'selected', 'radio-hc'), ('pressed', 'selected', 'radio-pc'), ('active', 'radio-hu'), ('selected', 'radio-nc'), {"sticky": ''} ) }, "Horizontal.Scrollbar.thumb": {"element create": ("image", 'hsb-n', {"border": 3, "sticky": "ew"}) }, "Horizontal.Scrollbar.grip": {"element create": ("image", 'hsb-g')}, "Horizontal.Scrollbar.trough": {"element create": ("image", 'hsb-t')}, "Vertical.Scrollbar.thumb": {"element create": ("image", 'vsb-n', {"border": 3, "sticky": "ns"}) }, "Vertical.Scrollbar.grip": {"element create": ("image", 'vsb-g')}, "Vertical.Scrollbar.trough": {"element create": ("image", 'vsb-t')}, "Scrollbar.uparrow": {"element create": ("image", 'arrowup-n', ("pressed", 'arrowup-p'), {"sticky": ''}) }, "Scrollbar.downarrow": {"element create": ("image", 'arrowdown-n', ("pressed", 'arrowdown-p'), {'sticky': ''}) }, "Scrollbar.leftarrow": {"element create": ("image", 'arrowleft-n', ("pressed", 'arrowleft-p'), {'sticky': ''}) }, "Scrollbar.rightarrow": {"element create": ("image", 'arrowright-n', ("pressed", 'arrowright-p'), {'sticky': ''}) }, "Horizontal.Scale.slider": {"element create": ("image", 'hslider-n', {'sticky': ''}) }, "Horizontal.Scale.trough": {"element create": ("image", 'hslider-t', {'border': 1, 'padding': 0}) }, "Vertical.Scale.slider": {"element create": ("image", 'vslider-n', {'sticky': ''}) }, "Vertical.Scale.trough": {"element create": ("image", 'vslider-t', {'border': 1, 'padding': 0}) }, "Entry.field": {"element create": ("image", 'entry-n', ("focus", 'entry-f'), {'border': 2, 'padding': [3, 4], 'sticky': 'news'} ) }, "Labelframe.border": {"element create": ("image", 'border', {'border': 4, 'padding': 4, 'sticky': 'news'}) }, "Menubutton.button": {"element create": ("image", 'combo-r', ('active', 'combo-ra'), {'sticky': 'news', 'border': [4, 6, 24, 15], 'padding': [4, 4, 5]} ) }, "Menubutton.indicator": {"element create": ("image", 'arrow-d', {"sticky": "e", "border": [15, 0, 0, 0]}) }, "Combobox.field": {"element create": ("image", 'combo-n', ('readonly', 'active', 'combo-ra'), ('focus', 'active', 'combo-fa'), ('active', 'combo-a'), ('!readonly', 'focus', 'combo-f'), ('readonly', 'combo-r'), {'border': [4, 6, 24, 15], 'padding': [4, 4, 5], 'sticky': 'news'} ) }, "Combobox.downarrow": {"element create": ("image", 'arrow-d', {'sticky': 'e', 'border': [15, 0, 0, 0]}) }, "Notebook.client": {"element create": ("image", 'notebook-c', {'border': 4}) }, "Notebook.tab": {"element create": ("image", 'notebook-tn', ("selected", 'notebook-ts'), ("active", 'notebook-ta'), {'padding': [0, 2, 0, 0], 'border': [4, 10, 4, 10]} ) }, "Progressbar.trough": {"element create": ("image", 'hprogress-t', {'border': 2}) }, "Horizontal.Progressbar.pbar": {"element create": ("image", 'hprogress-b', {'border': [2, 9]}) }, "Vertical.Progressbar.pbar": {"element create": ("image", 'vprogress-b', {'border': [9, 2]}) }, "Treeheading.cell": {"element create": ("image", 'tree-n', ("pressed", 'tree-p'), {'border': [4, 10], 'padding': 4, 'sticky': 'news'} ) } }) style.theme_use("plastik")