Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

PERL Tk Editor: Text alignment is not working in Text widget [-justify option]

by ungalnanban (Pilgrim)
on Mar 08, 2010 at 11:47 UTC ( #827365=perlquestion: print w/replies, xml ) Need Help??
ungalnanban has asked for the wisdom of the Perl Monks concerning the following question:

I am implementing editor in PERL Tk.
I am adding the feature as text alignment, like left,right or center.
I used Text widget and I used the -justify option that option is not working for me.
How can I solve this problem. See my code:
my $align = $fnt -> cascade(-label =>"Juesify",-underline => 0, +-tearoff => 0); $align -> command(-label =>"Left",-command=>sub { # $txt->configure( -justify =>'left'); $txt->tagConfigure('left', -justify => 'left'); print "Left"; } ); $align -> command(-label =>"Right",-command=>sub { #$txt->configure(-justify=>'right'); $txt->tagConfigure('right', -justify => 'right'); print "Right"; } ); $align -> command(-label =>"Center",-command=>sub { #$txt->configure(-justify=>'center'); $txt->tagConfigure('center', -justify => 'center'); print "Center"; } );

Refer the following link, I already post the same question
but I didn't got the answer,
  • Comment on PERL Tk Editor: Text alignment is not working in Text widget [-justify option]
  • Download Code

Replies are listed 'Best First'.
Re: PERL Tk Editor: Text alignment is not working in Text widget [-justify option]
by liverpole (Monsignor) on Mar 08, 2010 at 13:31 UTC

    Let me explain why I can't answer your question.

    Normally I love a good Tk problem.  Tk is fun to work with, and can almost always be made to do exactly what you want, even though it sometimes challenges you.

    So when I saw your question, I immediately cut and pasted the text into a new program to try it.  Of course, I didn't get anywhere because it's far from complete.

    Now think about it.  When you ask a question here, you're asking for help.  That means you have to meet us halfway.  Why should we have to guess what the beginning of your program looks like?!  That's extra work; likely to be useless, since we're not guaranteed to get the same error as you get.  All at once your question goes from a potentially interesting one to one I have no interest in solving.

    Now I see you've asked a similar question before, so I went and looked at that one too.  Well, guess what?  You're expecting us to do your work for you there, too!  You're not going to get much help if you can't be bothered to show more of your problem.  Only you know what the rest of the program is; why should we waste our time trying to guess at it?

Re: PERL Tk Editor: Text alignment is not working in Text widget [-justify option]
by Corion (Pope) on Mar 08, 2010 at 11:54 UTC

    Why do you post such long code, when your other post is much shorter? Much of your code likely has no bearing on the problem at hand.

    As an aside, whether something is urgent for you does not make it urgent for us.

Re: PERL Tk Editor: Text alignment is not working in Text widget [-justify option]
by Marshall (Abbot) on Mar 08, 2010 at 15:09 UTC
    Justify is a method for Tags. "A tag is a textual string that is associated with some of the characters in a text." Read this carefully: text widget

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://827365]
Approved by Corion
[erix]: heh: The Dutch do one thing very, very well
[LanX]: the sidekick of this blonde playboy model which was saving lives with her red bathing suit ... (what was her name again ...)
[choroba]: Pamela Anderson?
[choroba]: erix: I'm proud to be from a nation that also does one thing well
[LanX]: ah yes! And he called her Kit and she could talk while a light was going from her left to right eye and back...
[erix]: choroba: pretty impressive! :)
LanX imagines which nations would be dominating if the winter olympics were invented in East Asia
[LanX]: Corion: and that's the clue how Germany can dominate Handball tournaments, just continuing the domestic league and forbidding the best players of the world to attend :)
LanX (which would be a good scheme for England and football too)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2018-02-23 16:35 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (303 votes). Check out past polls.