Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tk - text->insert looses string format

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Joined
Feb 6, 2002
Messages
1,851
Location
IL
HI,
The same string ($temp) formated with sprintf,is correctly printed to a file using "print",but looses all it's formating when displayed in the Tk text->insert:

$temp=sprintf("%-55s %-30s %-10s %-16s %-10s\n", $key, $services{$key}, $state{$status{CurrentState}}, $startup{$value}, $status{ServiceType});

&disp($temp);

sub disp {
my $message=shift;
$txt -> insert('end',$message);

print "$message";
}


Appreciate any ideas.


Long live king Moshiach !
 
What does $message show when printed and what does it show when inserted?

-------------
Kirsle.net | Kirsle's Programs and Projects
 
Kirsle,

Tried pasting both results here,but in this window they both look the same ...
I'll now try experimenting with the format instead of using sprintf.
Thanks

Long live king Moshiach !
 
NO,using format does not help either...
The file IS formated,the text in the Tk window is not .
Got to be something simple,some parameter of txt-> ,or similar ?

Long live king Moshiach !
 
Er, Arial is proportional; Courier is fixed width.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top