# Tk::Iwidgets::Scrolledhtml render problem

**URL:** <https://www.ruby-forum.com/t/tk-scrolledhtml-render-problem/59514>\
**Category:** Ruby\
**Created:** [May 3, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/tk-scrolledhtml-render-problem/59514 "2006-05-03T19:11:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 3, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/tk-scrolledhtml-render-problem/59514/1 "2006-05-03T19:11:11Z")

</div>

I want a frame to pop up with this in it. $tbodytext is my var of html  
code. I did check the var before and after the render call, and it is  
correct (i know i should not use globa vars but its my first TK  
program and need to access info every where. I can also post my full  
code (other then render it works, and u just need tk and the gmailer  
library.)

So the question is, can it not render the string i pass it? If i set  
static text it displays that. i could save it to a file then read the  
file , but i dont really want to do that.

Becker

$tbody\_root=TkRoot.new  
$tbody\_frame\_over = TkToplevel.new($root){}  
$tbody\_frame\_over.withdraw

---------cut out code---------

#the $Account is a gmail count, this gets the email info  
localtext=""+$Account.msg(temp).dt\_easy + " subject:  
" + $Account.msg(temp).subject  
localtext=localtext+ " Body: "  
localtext=localtext+ test  
$tbodytexts=(localtext+"").to\_s  
p $tbodytexts  
x = (200)  
y = (200)  
$tbody\_frame\_over.geometry("+#{x+1}+#{y+1}")  
$tbody\_frame\_over.deiconify  
$tbody\_frame\_over.raise

cut out code

TkFrame.new($tbody\_frame\_over){  
tkbodys=Tk::Iwidgets::Scrolledhtml.new(self){ }.pack “side”=\>“top”  
tkbodys.height=200  
tt=$tbodytexts  
tkbodys.render(tt)  
TkButton.new(self) {  
text “ok”  
command {  
$tbody\_frame\_over.withdraw  
}}.pack “side”=\>“bottom”  
}.pack “side”=\>“left”

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 3, 2006, 1:28pm UTC](https://www.ruby-forum.com/t/tk-scrolledhtml-render-problem/59514/2 "2006-08-03T13:28:46Z")

</div>

I was trying every combination of anything, and this works. dont know  
what but it does.

I moved the elements of the frame up to the top instead of making a  
new frame, and moved the render to the call that makes it visable.  
Also i save the text to a temp file. I didnt want to do this, but it  
works.

Still any ideas would be welcome.

$tbody\_root=TkRoot.new  
$tbody\_frame\_over = TkToplevel.new($root){  
$gtkbodys=Tk::Iwidgets::Scrolledhtml.new(self){ }.pack “side”=\>“top”  
$gtkbodys.height=200  
TkButton.new(self) {  
text “ok”  
command {  
$tbody\_frame\_over.withdraw  
}}.pack “side”=\>“bottom”  
}  
$tbody\_frame\_over.withdraw

-------------cut-----

localtext=""+$Account.msg(temp).dt\_easy + " subject:  
" + $Account.msg(temp).subject  
localtext=localtext+ " Body: "  
localtext=localtext+ test  
$tbodytexts=(localtext+"").to\_s  
# p $tbodytexts  
x = (200)  
y = (200)

#tt=  
#p $tbodytexts  
tf = Tempfile.new(“afile”)  
tf.puts($tbodytexts)  
# p tf.path  
tf.close  
tf.open  
$gtkbodys.render($tbodytexts)  
$tbody\_frame\_over.geometry("+#{x+1}+#{y+1}")  
$tbody\_frame\_over.deiconify  
$tbody\_frame\_over.raise

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 3, 2006, 1:30pm UTC](https://www.ruby-forum.com/t/tk-scrolledhtml-render-problem/59514/3 "2006-08-03T13:30:13Z")

</div>

From: “ruby talk” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: Tk::Iwidgets::Scrolledhtml render problem  
Date: Sun, 19 Mar 2006 05:49:29 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> I was trying every combination of anything, and this works. dont know  
> what but it does.
> 
> I moved the elements of the frame up to the top instead of making a  
> new frame, and moved the render to the call that makes it visable.  
> Also i save the text to a temp file. I didnt want to do this, but it  
> works.

I couldn’t re-generate your problem.  
When did you call “Tk.mainloop”?  
“Tk.update” is sometimes helpful to fix some cases of drawing troubles.
