This question is the continuum of my question there:
wxPython - Panel doesn't cover all frame on show if frame full screen
I like solved the problem on the other question but the basic problem persists.
I have removed a horizontal panel so now I have 4 horizontal panels on a vertical box and a panel on the right. The panel on the right has a little space on bottom and right. The BoxSizer on the Left that contains all the panels have a space on the left and on the bottom.
This is the result when I launch the application:
As you can see the panels doesn't cover all the screen and there is no space on the right.
But if I do a resize of the window:
And I make it full screen again I get the result I want as you can see:
How can I solve that?
This is the updated code of my panel class:
import wx, threading
from Panels.Base.BasePanel import BasePanel
from Utils.NumberUtils import NumberUtils
from Utils.DesignUtils import DesignUtils
from Resources.Strings import Strings
from Resources.Constants import Constants, Sizes
class NewTradingBotPanel(BasePanel):
__mMainBox: wx.BoxSizer = None
__mSecondBox: wx.BoxSizer = None
__mRightPanel: wx.Panel = None
__mtxMaxDayChange: wx.TextCtrl = None
__mtxMinDayChange: wx.TextCtrl = None
__mtxMaxMarketCap: wx.TextCtrl = None
__mtxMinMarketCap: wx.TextCtrl = None
__mtxMaxDayRange: wx.TextCtrl = None
__mtxMinDayRange: wx.TextCtrl = None
__mtxMaxWeekRange: wx.TextCtrl = None
__mtxMinWeekRange: wx.TextCtrl = None
__mtxMaxMonthRange: wx.TextCtrl = None
__mtxMinMonthRange: wx.TextCtrl = None
__mtxMaxYearRange: wx.TextCtrl = None
__mtxMinYearRange: wx.TextCtrl = None
__mtxMaxDayVolume: wx.TextCtrl = None
__mtxMinDayVolume: wx.TextCtrl = None
__mtxMaxCompanyValue: wx.TextCtrl = None
__mtxMinCompanyValue: wx.TextCtrl = None
__mtxMaxRatioCompanyValueMarketCap: wx.TextCtrl = None
__mtxMinRatioCompanyValueMarketCap: wx.TextCtrl = None
__mtxMaxBeta: wx.TextCtrl = None
__mtxMinBeta: wx.TextCtrl = None
__mtxMaxRatioPE: wx.TextCtrl = None
__mtxMinRatioPE: wx.TextCtrl = None
__mtxMaxEPS: wx.TextCtrl = None
__mtxMinEPS: wx.TextCtrl = None
__mtxMaxYearTarget: wx.TextCtrl = None
__mtxMinYearTarget: wx.TextCtrl = None
__mtxMaxTrailingPE: wx.TextCtrl = None
__mtxMinTrailingPE: wx.TextCtrl = None
__mtxMaxForwardPE: wx.TextCtrl = None
__mtxMinForwardPE: wx.TextCtrl = None
__mtxMaxPegRatio: wx.TextCtrl = None
__mtxMinPegRatio: wx.TextCtrl = None
__mtxMaxPriceSales: wx.TextCtrl = None
__mtxMinPriceSales: wx.TextCtrl = None
__mtxMaxPriceBook: wx.TextCtrl = None
__mtxMinPriceBook: wx.TextCtrl = None
__mtxMaxCompanyValueRevenue: wx.TextCtrl = None
__mtxMinCompanyValueRevenue: wx.TextCtrl = None
__mtxMaxCompanyValueEbitda: wx.TextCtrl = None
__mtxMinCompanyValueEbitda: wx.TextCtrl = None
def __init__(self, parent, size):
super().__init__(parent, size)
self.__init_layout()
#region - Private Methods
#region - Init Methods
def __init_layout(self):
self.__mMainBox = wx.BoxSizer(wx.HORIZONTAL)
self.__mMainBox.AddSpacer(15)
self.__mSecondBox = wx.BoxSizer(wx.VERTICAL)
self.__mSecondBox.Fit(self)
self.__mSecondBox.AddSpacer(15)
self.__init_main_horizontal_panel(
self.__get_boxsizer_day_change,
self.__get_boxsizer_market_cap,
self.__get_boxsizer_day_range,
self.__get_boxsizer_week_range,
self.__get_boxsizer_month_range
)
self.__mSecondBox.AddSpacer(15)
self.__init_main_horizontal_panel(
self.__get_boxsizer_year_range,
self.__get_boxsizer_day_volume,
self.__get_boxsizer_company_value,
self.__get_boxsizer_ratio_company_value_market_cap,
self.__get_boxsizer_beta
)
self.__mSecondBox.AddSpacer(15)
self.__init_main_horizontal_panel(
self.__get_boxsizer_beta,
self.__get_boxsizer_beta,
self.__get_boxsizer_beta,
self.__get_boxsizer_beta,
self.__get_boxsizer_beta
)
self.__mSecondBox.AddSpacer(15)
self.__init_main_horizontal_panel(
self.__get_boxsizer_beta,
self.__get_boxsizer_beta,
self.__get_boxsizer_beta,
self.__get_boxsizer_beta,
self.__get_boxsizer_beta
)
self.__mSecondBox.AddSpacer(15)
self.__mMainBox.Add(self.__mSecondBox, 1, wx.ALL | wx.EXPAND)
vbs = wx.BoxSizer(wx.VERTICAL)
vbs.AddSpacer(15)
self.__init_right_panel()
vbs.Add(self.__mRightPanel, 1, wx.ALL | wx.EXPAND)
vbs.AddSpacer(15)
self.__mMainBox.Add(vbs, 1, wx.ALL | wx.EXPAND)
self.__mMainBox.AddSpacer(25)
self.__init_bind_listeners()
self.SetSizer(self.__mMainBox)
self.__mMainBox.Fit(self)
self.Layout()
self.Update()
self.Fit()
#region - Panels Methods
def __init_main_horizontal_panel(self, f1, f2, f3, f4, f5):
boxSizer = wx.BoxSizer(wx.HORIZONTAL)
boxSizer.AddSpacer(15)
panel = wx.Panel(self)
panel.SetBackgroundColour((88, 88, 88))
self.__mSecondBox.Add(panel, 1, wx.ALL | wx.EXPAND)
boxSizer.Add(f1(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f2(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f3(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f4(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f5(panel))
boxSizer.AddSpacer(50)
boxSizer.Fit(panel)
panel.SetSizer(boxSizer)
panel.Layout()
panel.Update()
panel.Fit()
def __init_right_panel(self):
self.__mRightPanel = wx.Panel(self)
self.__mRightPanel.SetBackgroundColour((66, 66, 66))
hbs = wx.BoxSizer(wx.HORIZONTAL)
hbs.AddSpacer(25)
vbs = wx.BoxSizer(wx.VERTICAL)
vbs.AddSpacer(25)
static = wx.StaticText(self.__mRightPanel, label = Strings.STR_SETTINGS_TO_CREATE_TRADING_BOT, style = wx.ALIGN_CENTRE)
vbs.Add(static, 0, wx.EXPAND, 50)
static.Wrap(self.__mRightPanel.Size[0])
hbs.Add(vbs)
hbs.AddSpacer(25)
self.__mRightPanel.SetSizer(hbs)
self.__mRightPanel.Fit()
#endregion
#region - Init Listeners Methods
def __init_bind_listeners(self):
self.__mtxMaxDayChange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinDayChange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxMarketCap.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinMarketCap.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxDayRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinDayRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxWeekRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinWeekRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxMonthRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinMonthRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxYearRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinYearRange.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxDayVolume.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinDayVolume.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxCompanyValue.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinCompanyValue.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxRatioCompanyValueMarketCap.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinRatioCompanyValueMarketCap.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxBeta.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinBeta.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxRatioPE.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinRatioPE.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxEPS.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinEPS.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxYearTarget.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinYearTarget.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxTrailingPE.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinTrailingPE.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxForwardPE.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinForwardPE.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxPegRatio.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinPegRatio.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxPriceSales.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinPriceSales.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxPriceBook.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinPriceBook.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxCompanyValueRevenue.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinCompanyValueRevenue.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMaxCompanyValueEbitda.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
self.__mtxMinCompanyValueEbitda.Bind(wx.EVT_CHAR, self.__listener_check_text_int_value)
#endregion
#region - Listeners Methods
def __listener_check_text_int_value(self, evt):
txt = evt.GetEventObject()
value = chr(evt.GetUnicodeKey())
if value.isnumeric() or value:
print("here 3")
txt.AppendText(value)
#endregion
#endregion
#region - BoxSizer Day Change Methods
def __get_boxsizer_day_change(self, panel):
bsDayChange = wx.BoxSizer(wx.VERTICAL)
bsDayChange.Add(self.__get_boxsizer_max_day_change(panel))
bsDayChange.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsDayChange.Add(self.__get_boxsizer_min_day_change(panel))
return bsDayChange
def __get_boxsizer_max_day_change(self, panel):
self.__mtxMaxDayChange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxDayChange = wx.BoxSizer(wx.VERTICAL)
bsMaxDayChange.Add(wx.StaticText(panel, label = Strings.STR_MAX_DAY_CHANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxDayChange.Add(self.__mtxMaxDayChange, 0, wx.EXPAND)
return bsMaxDayChange
def __get_boxsizer_min_day_change(self, panel):
self.__mtxMinDayChange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinDayChange = wx.BoxSizer(wx.VERTICAL)
bsMinDayChange.Add(wx.StaticText(panel, label = Strings.STR_MIN_DAY_CHANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinDayChange.Add(self.__mtxMinDayChange, 0, wx.EXPAND)
return bsMinDayChange
#endregion
#region - BoxSizer Market Cap Methods
def __get_boxsizer_market_cap(self, panel):
bsMarketCap = wx.BoxSizer(wx.VERTICAL)
bsMarketCap.Add(self.__get_boxsizer_max_market_cap(panel))
bsMarketCap.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsMarketCap.Add(self.__get_boxsizer_min_market_cap(panel))
return bsMarketCap
def __get_boxsizer_max_market_cap(self, panel):
self.__mtxMaxMarketCap = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxMarketCap = wx.BoxSizer(wx.VERTICAL)
bsMaxMarketCap.Add(wx.StaticText(panel, label = Strings.STR_MAX_MARKET_CAP, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxMarketCap.Add(self.__mtxMaxMarketCap, 0, wx.EXPAND)
return bsMaxMarketCap
def __get_boxsizer_min_market_cap(self, panel):
self.__mtxMinMarketCap = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinMarketCap = wx.BoxSizer(wx.VERTICAL)
bsMinMarketCap.Add(wx.StaticText(panel, label = Strings.STR_MIN_MARKET_CAP, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinMarketCap.Add(self.__mtxMinMarketCap, 0, wx.EXPAND)
return bsMinMarketCap
#endregion
#region - BoxSizer Day Range Methods
def __get_boxsizer_day_range(self, panel):
bsDayRange = wx.BoxSizer(wx.VERTICAL)
bsDayRange.Add(self.__get_boxsizer_max_day_range(panel))
bsDayRange.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsDayRange.Add(self.__get_boxsizer_min_day_range(panel))
return bsDayRange
def __get_boxsizer_max_day_range(self, panel):
self.__mtxMaxDayRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxDayRange = wx.BoxSizer(wx.VERTICAL)
bsMaxDayRange.Add(wx.StaticText(panel, label = Strings.STR_MAX_DAY_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxDayRange.Add(self.__mtxMaxDayRange, 0, wx.EXPAND)
return bsMaxDayRange
def __get_boxsizer_min_day_range(self, panel):
self.__mtxMinDayRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinDayRange = wx.BoxSizer(wx.VERTICAL)
bsMinDayRange.Add(wx.StaticText(panel, label = Strings.STR_MIN_DAY_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinDayRange.Add(self.__mtxMinDayRange, 0, wx.EXPAND)
return bsMinDayRange
#endregion
#region - BoxSizer Week Range Methods
def __get_boxsizer_week_range(self, panel):
bsWeekRange = wx.BoxSizer(wx.VERTICAL)
bsWeekRange.Add(self.__get_boxsizer_max_week_range(panel))
bsWeekRange.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsWeekRange.Add(self.__get_boxsizer_min_week_range(panel))
return bsWeekRange
def __get_boxsizer_max_week_range(self, panel):
self.__mtxMaxWeekRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxWeekRange = wx.BoxSizer(wx.VERTICAL)
bsMaxWeekRange.Add(wx.StaticText(panel, label = Strings.STR_MAX_WEEK_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxWeekRange.Add(self.__mtxMaxWeekRange, 0, wx.EXPAND)
return bsMaxWeekRange
def __get_boxsizer_min_week_range(self, panel):
self.__mtxMinWeekRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinWeekRange = wx.BoxSizer(wx.VERTICAL)
bsMinWeekRange.Add(wx.StaticText(panel, label = Strings.STR_MIN_WEEK_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinWeekRange.Add(self.__mtxMinWeekRange, 0, wx.EXPAND)
return bsMinWeekRange
#endregion
#region - BoxSizer Month Range Methods
def __get_boxsizer_month_range(self, panel):
bsMonthRange = wx.BoxSizer(wx.VERTICAL)
bsMonthRange.Add(self.__get_boxsizer_max_month_range(panel))
bsMonthRange.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsMonthRange.Add(self.__get_boxsizer_min_month_range(panel))
return bsMonthRange
def __get_boxsizer_max_month_range(self, panel):
self.__mtxMaxMonthRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxMonthRange = wx.BoxSizer(wx.VERTICAL)
bsMaxMonthRange.Add(wx.StaticText(panel, label = Strings.STR_MAX_MONTH_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxMonthRange.Add(self.__mtxMaxMonthRange, 0, wx.EXPAND)
return bsMaxMonthRange
def __get_boxsizer_min_month_range(self, panel):
self.__mtxMinMonthRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinMonthRange = wx.BoxSizer(wx.VERTICAL)
bsMinMonthRange.Add(wx.StaticText(panel, label = Strings.STR_MIN_MONTH_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinMonthRange.Add(self.__mtxMinMonthRange, 0, wx.EXPAND)
return bsMinMonthRange
#endregion
#region - BoxSizer Year Range Methods
def __get_boxsizer_year_range(self, panel):
bsYearRange = wx.BoxSizer(wx.VERTICAL)
bsYearRange.Add(self.__get_boxsizer_max_year_range(panel))
bsYearRange.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsYearRange.Add(self.__get_boxsizer_min_year_range(panel))
return bsYearRange
def __get_boxsizer_max_year_range(self, panel):
self.__mtxMaxYearRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxYearRange = wx.BoxSizer(wx.VERTICAL)
bsMaxYearRange.Add(wx.StaticText(panel, label = Strings.STR_MAX_YEAR_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxYearRange.Add(self.__mtxMaxYearRange, 0, wx.EXPAND)
return bsMaxYearRange
def __get_boxsizer_min_year_range(self, panel):
self.__mtxMinYearRange = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinYearRange = wx.BoxSizer(wx.VERTICAL)
bsMinYearRange.Add(wx.StaticText(panel, label = Strings.STR_MIN_YEAR_RANGE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinYearRange.Add(self.__mtxMinYearRange, 0, wx.EXPAND)
return bsMinYearRange
#endregion
#region - BoxSizer Day Volume Methods
def __get_boxsizer_day_volume(self, panel):
bsDayVolume = wx.BoxSizer(wx.VERTICAL)
bsDayVolume.Add(self.__get_boxsizer_max_day_volume(panel))
bsDayVolume.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsDayVolume.Add(self.__get_boxsizer_min_day_volume(panel))
return bsDayVolume
def __get_boxsizer_max_day_volume(self, panel):
self.__mtxMaxDayVolume = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxDayVolume = wx.BoxSizer(wx.VERTICAL)
bsMaxDayVolume.Add(wx.StaticText(panel, label = Strings.STR_MAX_DAY_VOLUME, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxDayVolume.Add(self.__mtxMaxDayVolume, 0, wx.EXPAND)
return bsMaxDayVolume
def __get_boxsizer_min_day_volume(self, panel):
self.__mtxMinDayVolume = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinDayVolume = wx.BoxSizer(wx.VERTICAL)
bsMinDayVolume.Add(wx.StaticText(panel, label = Strings.STR_MIN_DAY_VOLUME, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinDayVolume.Add(self.__mtxMinDayVolume, 0, wx.EXPAND)
return bsMinDayVolume
#endregion
#region - BoxSizer Company Value Methods
def __get_boxsizer_company_value(self, panel):
bsCompanyValue = wx.BoxSizer(wx.VERTICAL)
bsCompanyValue.Add(self.__get_boxsizer_max_company_value(panel))
bsCompanyValue.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsCompanyValue.Add(self.__get_boxsizer_min_company_value(panel))
return bsCompanyValue
def __get_boxsizer_max_company_value(self, panel):
self.__mtxMaxCompanyValue = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxCompanyValue = wx.BoxSizer(wx.VERTICAL)
bsMaxCompanyValue.Add(wx.StaticText(panel, label = Strings.STR_MAX_COMPANY_VALUE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxCompanyValue.Add(self.__mtxMaxCompanyValue, 0, wx.EXPAND)
return bsMaxCompanyValue
def __get_boxsizer_min_company_value(self, panel):
self.__mtxMinCompanyValue = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinCompanyValue = wx.BoxSizer(wx.VERTICAL)
bsMinCompanyValue.Add(wx.StaticText(panel, label = Strings.STR_MIN_COMPANY_VALUE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinCompanyValue.Add(self.__mtxMinCompanyValue, 0, wx.EXPAND)
return bsMinCompanyValue
#endregion
#region - BoxSizer Ratio Company Value Market Cap Methods
def __get_boxsizer_ratio_company_value_market_cap(self, panel):
bsRatioCompanyValueMarketCap = wx.BoxSizer(wx.VERTICAL)
bsRatioCompanyValueMarketCap.Add(self.__get_boxsizer_max_ratio_company_value_market_cap(panel))
bsRatioCompanyValueMarketCap.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsRatioCompanyValueMarketCap.Add(self.__get_boxsizer_min_ratio_company_value_market_cap(panel))
return bsRatioCompanyValueMarketCap
def __get_boxsizer_max_ratio_company_value_market_cap(self, panel):
self.__mtxMaxRatioCompanyValueMarketCap = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxRatioCompanyValueMarketCap = wx.BoxSizer(wx.VERTICAL)
bsMaxRatioCompanyValueMarketCap.Add(wx.StaticText(panel, label = Strings.STR_MAX_RATIO_COMPANY_VALUE_MARKET_CAP, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxRatioCompanyValueMarketCap.Add(self.__mtxMaxRatioCompanyValueMarketCap, 0, wx.EXPAND)
return bsMaxRatioCompanyValueMarketCap
def __get_boxsizer_min_ratio_company_value_market_cap(self, panel):
self.__mtxMinRatioCompanyValueMarketCap = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinRatioCompanyValueMarketCap = wx.BoxSizer(wx.VERTICAL)
bsMinRatioCompanyValueMarketCap.Add(wx.StaticText(panel, label = Strings.STR_MIN_RATIO_COMPANY_VALUE_MARKET_CAP, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinRatioCompanyValueMarketCap.Add(self.__mtxMinRatioCompanyValueMarketCap, 0, wx.EXPAND)
return bsMinRatioCompanyValueMarketCap
#endregion
#region - BoxSizer BETA Methods
def __get_boxsizer_beta(self, panel):
bsBeta = wx.BoxSizer(wx.VERTICAL)
bsBeta.Add(self.__get_boxsizer_max_beta(panel))
bsBeta.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsBeta.Add(self.__get_boxsizer_min_beta(panel))
return bsBeta
def __get_boxsizer_max_beta(self, panel):
self.__mtxMaxBeta = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxBeta = wx.BoxSizer(wx.VERTICAL)
bsMaxBeta.Add(wx.StaticText(panel, label = Strings.STR_MAX_BETA, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxBeta.Add(self.__mtxMaxBeta, 0, wx.EXPAND)
return bsMaxBeta
def __get_boxsizer_min_beta(self, panel):
self.__mtxMinBeta = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinBeta = wx.BoxSizer(wx.VERTICAL)
bsMinBeta.Add(wx.StaticText(panel, label = Strings.STR_MIN_BETA, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinBeta.Add(self.__mtxMinBeta, 0, wx.EXPAND)
return bsMinBeta
#endregion
#region - BoxSizer Ratio PE Methods
def __get_boxsizer_ratio_pe(self, panel):
bsRatioPE = wx.BoxSizer(wx.VERTICAL)
bsRatioPE.Add(self.__get_boxsizer_max_ratio_pe(panel))
bsRatioPE.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsRatioPE.Add(self.__get_boxsizer_min_ratio_pe(panel))
return bsRatioPE
def __get_boxsizer_max_ratio_pe(self, panel):
self.__mtxMaxRatioPE = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMaxRatioPE = wx.BoxSizer(wx.VERTICAL)
bsMaxRatioPE.Add(wx.StaticText(panel, label = Strings.STR_MAX_RATIO_PE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMaxRatioPE.Add(self.__mtxMaxRatioPE, 0, wx.EXPAND)
return bsMaxRatioPE
def __get_boxsizer_min_ratio_pe(self, panel):
self.__mtxMinRatioPE = wx.TextCtrl(panel, wx.ID_ANY, value = "", size = Sizes.INPUT_TEXT_SIZE_NEW_TRADING_BOT_PANEL)
bsMinRatioPE = wx.BoxSizer(wx.VERTICAL)
bsMinRatioPE.Add(wx.StaticText(panel, label = Strings.STR_MIN_RATIO_PE, style = wx.ALIGN_CENTRE), 0, wx.EXPAND)
bsMinRatioPE.Add(self.__mtxMinRatioPE, 0, wx.EXPAND)
return bsMinRatioPE
#endregion
#region - BoxSizer EPS Methods
def __get_boxsizer_eps(self, panel):
bsEPS = wx.BoxSizer(wx.VERTICAL)
bsEPS.Add(self.__get_boxsizer_max_eps(panel))
bsEPS.AddSpacer(Sizes.SPACER_TRADING_BOT_PANEL_GRID)
bsEPS.Add(self.__get_boxsizer_min_eps(panel))
return bsEPS
[...] Code Removed too many chars
I'd like to get the right result on the first launch and not after I resize and make the window full screen again.
As you can see the problem was like solved on the other question but I found out those problem when I added some decorators like the spacing ecc.
Thank you!
I solved this.
I just used a SplitterWindow to contains the left and right panel inside a BoxSizer with the borders.
def __init_layout(self):
self.__mMainBox = wx.BoxSizer(wx.HORIZONTAL)
self.__mMainBox.AddSpacer(10)
self.__mMainSplitter = wx.SplitterWindow(self)
self.__init_left_panel()
self.__init_right_panel()
self.__mMainSplitter.SplitVertically(self.__mLeftPanel, self.__mRightPanel, round((wx.DisplaySize()[0] / 10 * 7)))
self.__mMainBox.Add(self.__mMainSplitter, 1, wx.EXPAND)
self.__mMainBox.AddSpacer(10)
self.SetSizerAndFit(self.__mMainBox)
self.__mLeftPanel.Fit()
self.__mLeftPanel.SetupScrolling()
Before the:
self.__mMainBox.AddSpacer(10)
Wasn't working on the first go of the app, now it work right. On start the app has border on right and left and if I resize it it doesn't overlap the panels.
I also have 4 screens (1 left, 1 right, 1 on top and 1 at the center) of different sizes and the panels are right positioned in all the screen. All my screens have different sizes.
So yeah I think it can be useful to someone.
I also added:
panel.Update()
panel.Fit()
panel.SetAutoLayout(True)
And the AUtoLayout works good.
End of the code to init the panels:
#region - Panels Methods
def __get_boxsizer_trading_strategy(self):
main = wx.BoxSizer(wx.VERTICAL)
main.Add(self.__get_panel_trading_strategy_label(), 0, wx.EXPAND)
main.Add(
self.__get_panel_trading_strategy_data(
self.__get_boxsizer_day_change,
self.__get_boxsizer_market_cap,
self.__get_boxsizer_day_range,
self.__get_boxsizer_week_range,
), 1, wx.ALL | wx.EXPAND)
main.AddSpacer(15)
main.Add(
self.__get_panel_trading_strategy_data(
self.__get_boxsizer_month_range,
self.__get_boxsizer_year_range,
self.__get_boxsizer_day_volume,
self.__get_boxsizer_company_value
), 1, wx.ALL | wx.EXPAND)
main.AddSpacer(15)
main.Add(
self.__get_panel_trading_strategy_data(
self.__get_boxsizer_ratio_company_value_market_cap,
self.__get_boxsizer_beta,
self.__get_boxsizer_ratio_pe,
self.__get_boxsizer_eps
), 1, wx.ALL | wx.EXPAND)
main.AddSpacer(15)
main.Add(
self.__get_panel_trading_strategy_data(
self.__get_boxsizer_year_target,
self.__get_boxsizer_trailing_pe,
self.__get_boxsizer_forward_pe,
self.__get_boxsizer_peg_ratio
), 1, wx.ALL | wx.EXPAND)
main.AddSpacer(15)
main.Add(
self.__get_panel_trading_strategy_data(
self.__get_boxsizer_price_sales,
self.__get_boxsizer_price_book,
self.__get_boxsizer_company_value_revenue,
self.__get_boxsizer_company_value_ebitda
), 1, wx.ALL | wx.EXPAND)
return main
def __get_panel_data(self):
panel = wx.Panel(self.__mLeftPanel)
main = wx.BoxSizer(wx.VERTICAL)
hbs = wx.BoxSizer(wx.HORIZONTAL)
panel.SetSizer(main)
def __get_panel_trading_strategy_label(self):
panel = wx.Panel(self.__mLeftPanel)
panel.SetBackgroundColour((66, 66, 66))
hbs = wx.BoxSizer(wx.HORIZONTAL)
static = wx.StaticText(panel, label = Strings.STR_TRADING_STRATEGY_DATA.upper(), style = wx.TE_CENTRE)
WxUtils.set_font_size_and_bold(static, 15)
hbs.Add(static, 1, wx.EXPAND)
panel.SetSizer(hbs)
return panel
def __get_panel_trading_strategy_data(self, f1, f2, f3, f4):
boxSizer = wx.BoxSizer(wx.HORIZONTAL)
boxSizer.AddSpacer(15)
panel = wx.Panel(self.__mLeftPanel)
panel.SetBackgroundColour((88, 88, 88))
boxSizer.Add(f1(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f2(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f3(panel))
boxSizer.AddSpacer(50)
boxSizer.Add(f4(panel))
boxSizer.AddSpacer(50)
boxSizer.Fit(panel)
panel.SetSizer(boxSizer)
panel.Update()
panel.Fit()
panel.SetAutoLayout(True)
return panel
def __init_left_panel(self):
self.__mLeftPanel = wx.lib.scrolledpanel.ScrolledPanel(self.__mMainSplitter, wx.ID_ANY)
self.__mLeftPanel.SetSizer(self.__get_boxsizer_trading_strategy())
self.__init_bind_listeners()
def __init_right_panel(self):
self.__mRightPanel = wx.lib.scrolledpanel.ScrolledPanel(self.__mMainSplitter, wx.ID_ANY)
self.__mRightPanel.SetBackgroundColour((66, 66, 66))
self.__mRightPanel.SetupScrolling()
hbs = wx.BoxSizer(wx.HORIZONTAL)
hbs.AddSpacer(15)
vbs = wx.BoxSizer(wx.VERTICAL)
vbs.AddSpacer(5)
vbs.Add(wx.StaticText(self.__mRightPanel, label = Strings.STR_SPECIFICS_BOT, style = wx.ALIGN_CENTRE), 0, wx.EXPAND|wx.ALL)
vbs.AddSpacer(5)
self.__set_texts_bot_info()
vbs.Add(self.__mVerticalBoxBotInfos)
hbs.Add(vbs)
vbs.AddSpacer(25)
vbs.Add(self.__get_buttons())
hbs.AddSpacer(25)
hbs.Fit(self.__mRightPanel)
self.__mRightPanel.SetSizer(hbs)
self.__mRightPanel.Fit()
def __get_buttons(self):
hbs = wx.BoxSizer(wx.HORIZONTAL)
hbs.Add(super()._get_button(self.__mRightPanel, Strings.STR_RESET_ALL, self.__on_click_button_reset_values))
hbs.AddSpacer(50)
hbs.Add(super()._get_button(self.__mRightPanel, Strings.STR_SAVE, self.__on_click_button_save))
return hbs
#endregion
My screens are like that and it works right on all of them with the right proportions: