Reputation: 9492
Is there any way to make the tkinter label widget
vertical? Something like this
or is it just simply impossible? I have already look around and can't seems to find how to do it.By the way, i have tried orient='vertical'
but label widget
doesn't seems to support it.
Upvotes: 10
Views: 14028
Reputation: 81
This is an issue I have also run into, and unfortunately there still is no simple angle argument for the tkinter Label
widget. Nevertheless, to work around this whilst allowing dynamic labels, you can use the create_text()
function within the tkinter canvas
, which does have an angle argument. An example snippet from my code:
canvas_1_manage = tkinter.Canvas(nodeManager.window, width = 12, height = 50)
canvas_1_manage.grid(row = 0, column = 0)
canvas_1_manage.create_text(6, 50, text = "Node", angle = 90, anchor = "w")
This is part of a window builder function which produces the following: nodeManager Window
Upvotes: 6
Reputation: 385970
No, there is no way to display rotated text in the tkinter Label widget.
Upvotes: 5
Reputation: 329
You can achieve vertical display, without the text rotation, by using the wraplength option which set to 1 will force the next char into a new line:
Label( master_frame, text="Vertical Label", wraplength=1 ).grid( row=0, column=0 )
Upvotes: 8