Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by ungalnanban (Pilgrim)
on Mar 08, 2010 at 11:47 UTC ( [id://827365]=perlquestion: print w/replies, xml ) Need Help??

ungalnanban has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
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,

http://www.perlmonks.org/?node_id=825839
--sugumar--

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
    ungalnanban,

    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?


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Re: PERL Tk Editor: Text alignment is not working in Text widget [-justify option]
by Corion (Patriarch) 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 (Canon) 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://827365]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-19 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found