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 "lblImperialCou nt.TextAlign = ContentAlignmen t.MiddleRight" to it doesn't seem to make a difference either...
I hope I am clear enough with my questions :)
Thanks
2 17519
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("7 50x350")
#Crate a Label widget
label1= Label(win, text="Box1")
label1.pack()
label2= Label(win, text= "\nKeep\nLearni ng", bd=1, relief= "solid",fon t= ("Helvetica 20"), justify= RIGHT)
label2.pack()
Label(win, text= "Box2").pac k()
label3= Label(win, text="\nLearnin g\nMakes\nPerfe ct", bd=1, relief="solid", font=('Helvetic a 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 text justification! This seems incredible, that
MS would create a brand new application, and not...
|
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 AjaxControlToolkit.RatingEventArgs)
Dim SQL As String
Dim ExecSP As New dbFun
|
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 <div> containing e.g. a description of something via JavaScript. although it is not exactly specified...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |