{"id":1358,"date":"2022-01-06T01:31:35","date_gmt":"2022-01-06T09:31:35","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1358"},"modified":"2022-01-06T01:54:36","modified_gmt":"2022-01-06T09:54:36","slug":"133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2\/","title":{"rendered":"#258 Tk example"},"content":{"rendered":"<p>Example:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nwm withdraw .\r\nset w &#x5B;toplevel .t]\r\nwm title .t {Tk Code Example}\r\nset m &#x5B;menu $w.menubar -tearoff 0]\r\n$m add cascade -label File -menu &#x5B;menu $m.file]\r\n$m.file add command -label Quit -command exit\r\n$m add cascade -label Help -menu &#x5B;menu $m.help]\r\n$m.help add command -label Index -command {puts &quot;It will be added in next version.&quot;}\r\n$w configure -menu $m\r\nset f &#x5B;frame $w.f1]\r\npack &#x5B;label $f.label -text {A label}] -side left\r\npack &#x5B;entry $f.entry] -side left -fill x -expand true\r\n$f.entry insert 0 {This is an entry}\r\npack $f -fill x -padx 2 -pady 2\r\nset f &#x5B;frame $w.f2]\r\npack &#x5B;frame $f.rg -relief groove -bd 3] -side left -fill x -expand true\r\npack &#x5B;label $f.rg.lbl -text Radiobuttons:] -side left\r\npack &#x5B;radiobutton $f.rg.b1 -text Tea -variable choice -value 1] -side left\r\npack &#x5B;radiobutton $f.rg.b2 -text Coffee -variable choice -value 0] -side left\r\npack &#x5B;frame $f.cg -relief groove -bd 3] -side left -fill x -expand true\r\npack &#x5B;label $f.cg.lbl -text Checkbuttons:] -side left\r\npack &#x5B;checkbutton $f.cg.b1 -text Cream] -side left\r\npack &#x5B;checkbutton $f.cg.b2 -text Sugar] -side left\r\npack $f -fill x -padx 2 -pady 2\r\nset f &#x5B;frame $w.f3]\r\npack &#x5B;label $f.lbl -text Scale:] -side left\r\npack &#x5B;label $f.val -textvariable scaleval -width 4] -side left\r\npack &#x5B;scale $f.scl -variable scaleval -orient horizontal -from 0 -to 10 -showvalue false] \\\r\n-side left -fill x -expand true\r\npack $f -fill x -padx 2 -pady 2\r\nset f &#x5B;frame $w.f4 -relief groove -bd 3]\r\npack &#x5B;frame $f.lf] -side left -fill both -padx 3 -pady 3\r\npack &#x5B;listbox $f.lf.lb -yscrollcommand &quot;$f.lf.sb set&quot; -height 4] -side left -fill both -expand true\r\npack &#x5B;scrollbar $f.lf.sb -command &quot;$f.lf.lb yview&quot;] -side left -fill y\r\n$f.lf.lb insert end {Line 1 of listbox} {Line 2 of listbox}\r\npack &#x5B;frame $f.tf] -side left -fill both -expand true -padx 3 -pady 3\r\ngrid columnconfigure $f.tf 0 -weight 1\r\ngrid rowconfigure $f.tf 0 -weight 1\r\ngrid &#x5B;text $f.tf.tx -yscrollcommand &quot;$f.tf.sy set&quot; -height 4 -width 25 -xscrollcommand &quot;$f.tf.sx set&quot;] \\\r\n-column 0 -row 0 -sticky nsew\r\ngrid &#x5B;scrollbar $f.tf.sy -command &quot;$f.tf.tx yview&quot;] -column 1 -row 0 -sticky ns\r\ngrid &#x5B;scrollbar $f.tf.sx -command &quot;$f.tf.tx xview&quot; -orient horizontal] -column 0 -row 1 -sticky ew\r\n$f.tf.tx insert end {This is a text widget}\r\npack $f -fill both -expand true -padx 2 -pady 2\r\nset f &#x5B;frame $w.f5]\r\nbutton $f.b1 -text Apply -default active -command {puts $scaleval}\r\nbutton $f.b2 -text Reset -default normal -command {set scaleval 0}\r\nbutton $f.b3 -text Quit -default normal -command exit\r\npack $f.b1 $f.b2 $f.b3 -padx 10 -side left\r\npack $f -pady 2\r\n<\/pre>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/01\/2022-01-06_015252.png?resize=411%2C270&#038;ssl=1\" alt=\"\" width=\"411\" height=\"270\" class=\"alignnone size-full wp-image-1360\" srcset=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/01\/2022-01-06_015252.png?w=411&amp;ssl=1 411w, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/01\/2022-01-06_015252.png?resize=300%2C197&amp;ssl=1 300w, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/01\/2022-01-06_015252.png?resize=150%2C99&amp;ssl=1 150w\" sizes=\"(max-width: 411px) 100vw, 411px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Example: wm withdraw . set w &#x5B;toplevel .t] wm title .t {Tk Code Example} set m &#x5B;menu $w.menubar -tearoff 0] $m add cascade -label File -menu &#x5B;menu $m.file] $m.file add command -label Quit -command exit $m add cascade -label Help -menu &#x5B;menu $m.help] $m.help add command -label Index -command {puts &quot;It will be added in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[27],"tags":[],"class_list":["post-1358","post","type-post","status-publish","format-standard","hentry","category-tcl"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-lU","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":374,"url":"https:\/\/gantovnik.com\/bio-tips\/2019\/01\/tkinter-pack-geometry-manager\/","url_meta":{"origin":1358,"position":0},"title":"#53 Tkinter pack geometry manager","author":"gantovnik","date":"2019-01-30","format":false,"excerpt":"[code language=\"python\"] import os from tkinter import * os.chdir(r'D:\\projects\\wordpress\\ex53') root = Tk() Button(root,text=\"A\").pack(side=LEFT,expand=YES,fill=Y) Button(root,text=\"B\").pack(side=TOP,expand=YES,fill=BOTH) Button(root,text=\"C\").pack(side=RIGHT,expand=YES,fill=NONE,anchor=NE) Button(root,text=\"D\").pack(side=LEFT,expand=NO,fill=Y) Button(root,text=\"E\").pack(side=TOP,expand=NO,fill=BOTH) Button(root,text=\"F\").pack(side=RIGHT,expand=NO,fill=NONE) Button(root,text=\"G\").pack(side=BOTTOM,expand=YES,fill=Y) Button(root,text=\"H\").pack(side=TOP,expand=NO,fill=BOTH) Button(root,text=\"I\").pack(side=RIGHT,expand=NO) Button(root,text=\"J\").pack(anchor=SE) root.mainloop() [\/code]","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"example63","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2019\/01\/example63.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1047,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/187-feet-to-meter-converter-using-python-tcl-tk\/","url_meta":{"origin":1358,"position":1},"title":"#187 Feet to meter converter using python tcl\/tk","author":"gantovnik","date":"2021-11-07","format":false,"excerpt":"[code language=\"python\"] package require Tk wm title . \"Feet to Meters\" grid [ttk::frame .c -padding \"3 3 12 12\"] -column 0 -row 0 -sticky nwes grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1 grid [ttk::entry .c.feet -width 7 -textvariable feet] -column 2 -row 1 -sticky we\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex187.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1403,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/02\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2\/","url_meta":{"origin":1358,"position":2},"title":"#268 A progress indicator using tcl\/tk","author":"gantovnik","date":"2022-02-10","format":false,"excerpt":"#268 A progress indicator using tcl\/tk. [code language=\"python\"] # Create a simple progress gauge set, initially set to 0% proc gaugeCreate {win {color \"gray\"} } { frame $win canvas $win.display \\ -borderwidth 0 \\ -background white \\ -highlightthickness 0 \\ -width 200 \\ -height 20 pack $win.display -expand yes $win.display\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/02\/ex268.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1400,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/02\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2\/","url_meta":{"origin":1358,"position":3},"title":"#267 tk_getOpenFile in tcl\/tk","author":"gantovnik","date":"2022-02-10","format":false,"excerpt":"#267 tk_getOpenFile in tcl\/tk. [code language=\"python\"] set types { {\"All Source Files\" {.tcl} } {\"Image Files\" {.txt} } {\"All files\" *} } proc doIt {label} { global types set file [tk_getOpenFile -filetypes $types -parent .] $label configure -text $file } label .l -text \"No File\" button .b -text \"Select a\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/02\/ex267.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":828,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/01\/145-method-create_text-in-tkinter\/","url_meta":{"origin":1358,"position":4},"title":"#145 Method create_text in tkinter","author":"gantovnik","date":"2021-01-02","format":false,"excerpt":"#145 Method create_text in tkinter [code language=\"python\"] #!\/usr\/bin\/env python3 from tkinter import Tk, Canvas, Frame, BOTH, W class Example(Frame): def __init__(self): super().__init__() self.initUI() def initUI(self): self.master.title(\"Method create_text in tkinter\") self.pack(fill=BOTH, expand=1) canvas = Canvas(self) canvas.create_text(20, 30, anchor=W, font=\"Comix\", text=\"First line\") canvas.create_text(20, 60, anchor=W, font=\"Comix\", text=\"Second line\") canvas.create_text(20, 130, anchor=W, font=\"Comix\",\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/01\/ex145.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1933,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/381-overlapping-densities-ridge-plot-using-seaborn-library\/","url_meta":{"origin":1358,"position":5},"title":"#381 Overlapping densities ridge plot using seaborn library","author":"gantovnik","date":"2023-08-10","format":false,"excerpt":"[code language=\"python\"] #Overlapping densities ridge plot using seaborn library import matplotlib.pyplot as plt import pandas as pd import numpy as np #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"white\", rc={\"axes.facecolor\": (0, 0, 0, 0)}) def main(): # Create the data rs = np.random.RandomState(1979) x = rs.randn(500) g =\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1358"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1358\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}