Moved from python 3.9 / wxpython 2.1 to python 3.10 / wxpython 2.2. In my virtual ultimatelistctrl I am using a combo of ULC_FORMAT_LEFT and ULC_FORMAT_CENTER. No problems previously. Now I cant get ULC_FORMAT_CENTER to work. When building the list columns once it hits a column with centered text that column plus all others are not drawn and the following error is given;
Traceback (most recent call last):
File “C:\Python310\lib\site-packages\wx\lib\agw\ultimatelistctrl.py”, line 5284, in OnPaint
self.DrawTextFormatted(dc, text, wx.Rect(xAligned+EXTRA_WIDTH, HEADER_OFFSET_Y, cw-EXTRA_WIDTH, h-4))
TypeError: Rect(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type ‘float’
overload 3: argument 1 has unexpected type ‘float’
overload 4: argument 1 has unexpected type ‘float’
overload 5: argument 1 has unexpected type ‘float’
overload 6: argument 1 has unexpected type ‘float’
If I change the columns to left justified then no errors.
The code I use to create the headers is as follows (Your will see the center is commented out);
Create the columns
bold_font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
bold_font.SetWeight(wx.BOLD)
bold_font.SetPointSize(8)
info = ulc.UltimateListItem()
info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_WIDTH | wx.LIST_MASK_FORMAT | ulc.ULC_MASK_FONT
def add_one_column(column, text, width, font, position_format):
info._text = text
info._width = width
info._font = font
info._format = position_format
custom_render = UltimateHeaderRenderer(self, application_colors)
info.SetCustomRenderer(custom_render)
self.InsertColumnInfo(column, info)
columns_list = [
(
index_rom_name,
'ROM Name',
rom_name_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_rom_file_name,
'File Name',
file_name_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_system_program_file_name,
'System File',
system_file_name_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_system_short_name,
'Short Name',
short_name_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_exists,
'Exists',
exists_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
# ulc.ULC_FORMAT_CENTER
),
(
index_rating,
'Rating',
rating_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
# ulc.ULC_FORMAT_CENTER
),
(
index_number_runs,
'Runs',
number_of_runs_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
# ulc.ULC_FORMAT_CENTER
),
(
index_favorite,
'Fav',
favorite_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
# ulc.ULC_FORMAT_CENTER
),
(
index_category,
'Category',
category_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_path_media_name,
'Path Media Name',
path_media_name_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_year,
'Year',
year_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
),
(
index_manufacturer,
'Manufacturer',
manufacturer_col_size,
bold_font,
ulc.ULC_FORMAT_LEFT
)
]
for line in columns_list:
add_one_column(line[0], line[1], line[2], line[3], line[4])
Any ideas what the latest wxpython isn’t liking?