I want to create a new window when a particular button is pressed and the newly created window should contain labels/entries/buttons. My code goes something like this..
. configure -width 400 -height 400
label .header -text "Bitfields"
place .header -x 5 -y 0
.................................
toplevel .window -width 100 -height 120
Now I want to create a button/label on the newly created window . How am I supposed to do that? Google mostly provides examples for tkinter which I think is linked to python which I am not using. As a sub question how can I make this window appear when a button is clicked from the parent window?
To create a button/label on the newly created window (called .window
):
button .window.button1 -text "ok"
To make a window appear when a button is clicked from the parent window:
proc showWindow {w} {
catch {destroy $w}
toplevel $w
button $w.button1 -text "ClickMe"
pack $w.button1
}
. configure -width 400 -height 400
button .header -text "Bitfields" -command "showWindow .window"
place .header -x 5 -y 0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.