简体   繁体   中英

How to display a content of file in tcl notebook frame

I am writing a tcl notebook code to show Errors in first tab and Warnings in other. However this Error and warnings needs to be displayed in frame area of tcl notebook, i tried few options but it didn't work. These errors and warnings needs to be read from some external file.

errors.txt file looks like this

Errors DFF_X9ATH failing
Error DFFX_A9th_XC is faiing

Here is my code, plzz guide me how to open Error.txt and warn.txt in tkk frame area.

#!/usr/bin/wish

package require Tk


set file "errors.txt"
ttk::notebook .n  -width 800 -height 800
ttk::frame .n.f1; 
ttk::frame .n.f2; 
.n add .n.f1 -text "Errors"
.n add .n.f2 -text "Warnings"
pack [label .n.f1.f2 -background red -foreground white -text "Errors"]
pack [label .n.f2.f2 -background red -foreground white -text "Warnings"]
pack .n 

I think the best option would be to use text widgets instead of labels. When you've packed the text widgets, you can add text using <widget path> insert end <file content> , with the parts inside <> replaced by the relevant parts in your code.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM