Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Center align
#1
Hello,

Is there a way to center align ws3 cells as the values from ws1 get written into the ws3?


   ws3[f'A{i+2}']=ws1['A1'].value[28:]
   ws3[f'D{i+2}']=ws1['B4'].value
   ws3[f'E{i+2}']=ws1['D4'].value
   ws3[f'I{i+2}']=ws1['B'][-1].value
   ws3[f'J{i+2}']=ws1['D'][-1].value
   ws3[f'O{i+2}']=ws1['E'][-1].value
   ws3[f'N{i+2}']=ws2[f'I{i+6}'].value 
Reply
#2
Center alignment requires an assumption of total width. How do you know what the maximum width should be?

It's uncommon to put alignment into your data cells. Instead, you would apply formatting when the data is read/displayed and do it dynamically based upon the data. There are a lot of modules that can take tabular data and apply an alignment to it as printed.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to center askstring tkinter ruddlev 4 1,754 Aug-01-2024, 06:48 PM
Last Post: deanhystad
  How to auto align x-axis label SamLiu 2 2,052 Jan-27-2023, 11:10 PM
Last Post: SamLiu
  (OpenCV) Help to improve code for object detection and finding center of it saoko 0 2,022 May-14-2022, 05:34 PM
Last Post: saoko
  PyQT5 - align left frohr 7 6,508 May-07-2022, 09:56 PM
Last Post: deanhystad
  [S0LVED] [Tkinter] Center dialog? Winfried 8 7,369 Mar-01-2022, 07:17 PM
Last Post: Winfried
  Program to move a dot towards a circle center plumberpy 10 6,891 Dec-03-2021, 12:20 PM
Last Post: BashBedlam
  How to left align logging messages Mekala 3 9,411 Jun-28-2020, 04:04 PM
Last Post: bowlofred
  How to left align the columns SriRajesh 6 5,197 Dec-28-2019, 04:04 PM
Last Post: SriRajesh
  Image : center and resizing vvv 1 13,266 May-14-2017, 03:41 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020