Quick question, I have a label that is counting the letters that are typed in a textbox. But what I do want with that label is that I need it to be right justified. If I set the properties of the label to have right align it doesn't seem to work. So do I need to align it in the code so when it hits double digits it doesn't run over the item to the right but just expands to the left... How can I justify the label via code?
Here's the code I'm using for the label... -
Dim a As Object
-
a = Len(Me.tbImperial.Text)
-
lblImperialCount.Text = (1 + a)
-
Adding "lblImperialCount.TextAlign = ContentAlignment.MiddleRight" to it doesn't seem to make a difference either...
I hope I am clear enough with my questions :)
Thanks
2 17497
A label has no Text property, but a Caption property.
Your code should read: - Dim a As Object
-
a = Len(Me.tbImperial.Text)
-
lblImperialCount.Caption = (1 + a)
Tkinter Label widgets are used to add images and create text in a particular application. There are various functions and methods available in the library which can be used to style the widgets and its property. In order to justify the text in the label widget, we can use the justify property. It is generally used to justify the position or the alignment of the text such as RIGHT, LEFT, and CENTER.
Example
In this application, we will justify the position of a text label using the justify property.
#Import tkinter library
from tkinter import *
#Create an instance of tkinter frame or window
win= Tk()
#Set the geometry of tkinter frame
win.geometry("750x350")
#Crate a Label widget
label1= Label(win, text="Box1")
label1.pack()
label2= Label(win, text= "\nKeep\nLearning", bd=1, relief= "solid",font= ("Helvetica 20"), justify= RIGHT)
label2.pack()
Label(win, text= "Box2").pack()
label3= Label(win, text="\nLearning\nMakes\nPerfect", bd=1, relief="solid", font=('Helvetica 20'), justify= LEFT)
label3.pack()
win.mainloop()
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alex |
last post by:
The JustiDirect text justification on Stephen LeBans site works well
but I cannot get it to work on a sub report. Could anyone tell me if
this is possible.
Thanks.
Alex
|
by: Victor Nazarov |
last post by:
Consider I want to write my own version of standard malloc, calloc,
realloc, free. How can I portably check if they work correctly? The most
remarkable will be the test for right justification of each C type
dynamicly allocated.
--
vir
|
by: pavan |
last post by:
in my code i am storing the contents into a label
// code is as follows
lblSecurity.Text = lblSecurity.Text & vbCrLf & _
"Task Description"
this is not working though.
please advise
|
by: Neil |
last post by:
Just found out that the Microsoft Rich Textbox does not support full text
justification, since it's based on Version 1.0 of the RichEdit Window Class,
and full text justification is only available in versions 3.0 or later of
the class.
However, also just found out that the new Rich Text property in Access 2007
ALSO does not support full...
|
by: gaetanoortisi |
last post by:
Hello,
can anyone point me to some piece of code that do text
justification of fixed fonts like those that nroff do on manpages?
Thanks,
Gaetano
| |
by: lamarant |
last post by:
OK...I have a datalist that, in each row, has control and a label. What I want to happen is for the text in the label to update when its associated control is clicked.
Here's what I have so far...just need to get that label updating.
The Control's OnChange Event:
Private Sub Rating_Changed(ByVal sender As Object, ByVal e As...
|
by: crystal2005 |
last post by:
Hi all,
Can anyone tell me why my image doesn't appear in my frame's container? When I change imageIcon to just normal Label, it does go work.
In another condition, if i don't use method return (what is it called? emm...). ImageIcon does work on my normal Label.
package practise;
import java.awt.*;
|
by: Dormilich |
last post by:
Hi,
I just have one thing about the label element, where I’m not certain. <label> is commonly used to attach visual/text information to a form control. so far, so good.
<!-- just to make it visible -->
<input type="checkbox" value="yes" id="mysql">
<label for="mysql">save MySQL</label>
Now supposing I want to toggle the visibility of a...
|
by: pooja8389 |
last post by:
plz tell me how can i give the text "" to textbox and label?
if i use this shows the blank page and if i use (Text="""") then it shows output:"""".
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
|
by: priyasomu |
last post by:
I tried to move label option in asp.net 2008 version but I cant..I gave this code in html part:
<asp:Label ID ="my label" runat="server" style="position:absolute;display:block;" </asp:label>
But I am getting message as Error Creating Control - my label The server tag is not well formed.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |