[Update] Main Window: Message Box. メッセージ入力欄のサイズを変更できるように。厳密な計算はしてません。
【見た目への影響大】デフォルトのチャット入力欄を少し大きくしました。(もちろん変更できる) テキストボックスとの比率としているので、Windowサイズを変更すると、それに合わせて可変します。 CTkEntryからCTkTextboxに変更しました。プレースホルダーの使用が厳しくなったので廃止しました。最小にしても、入力中の位置が中央にならないなど、デザインが若干崩れましたが許容しました。
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
from customtkinter import CTkFont, CTkFrame, CTkEntry
|
||||
from customtkinter import CTkFont, CTkFrame, CTkTextbox
|
||||
|
||||
def createEntryMessageBox(settings, main_window):
|
||||
main_window.main_entry_message_container = CTkFrame(main_window.main_bg_container, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0)
|
||||
main_window.main_entry_message_container.grid(row=2, column=0, sticky="ew")
|
||||
main_window.main_entry_message_container.grid(row=2, column=0, sticky="nsew")
|
||||
|
||||
|
||||
main_window.main_entry_message_container.grid_columnconfigure(0, weight=1)
|
||||
main_window.entry_message_box = CTkEntry(
|
||||
main_window.main_entry_message_container.grid_rowconfigure(0, weight=1)
|
||||
main_window.entry_message_box = CTkTextbox(
|
||||
main_window.main_entry_message_container,
|
||||
border_color=settings.ctm.TEXTBOX_ENTRY_BORDER_COLOR,
|
||||
fg_color=settings.ctm.TEXTBOX_ENTRY_BG_COLOR,
|
||||
text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR,
|
||||
placeholder_text="Enter your message...",
|
||||
placeholder_text_color=settings.ctm.TEXTBOX_ENTRY_PLACEHOLDER_COLOR,
|
||||
height=settings.uism.TEXTBOX_ENTRY_HEIGHT,
|
||||
border_width=settings.uism.TEXTBOX_ENTRY_BORDER_SIZE,
|
||||
height=0,
|
||||
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.TEXTBOX_ENTRY_FONT_SIZE, weight="normal"),
|
||||
)
|
||||
main_window.entry_message_box.grid(row=0, column=0, padx=settings.uism.TEXTBOX_ENTRY_PADX, pady=settings.uism.TEXTBOX_ENTRY_PADY, sticky="nsew")
|
||||
main_window.entry_message_box._entry.grid(padx=settings.uism.TEXTBOX_ENTRY_IPADX, pady=settings.uism.TEXTBOX_ENTRY_IPADY)
|
||||
|
||||
|
||||
def messageBoxAnyKeyPress(e):
|
||||
|
||||
@@ -142,6 +142,7 @@ def createTextbox(settings, main_window, view_variable):
|
||||
fg_color=settings.ctm.TEXTBOX_BG_COLOR,
|
||||
text_color="lime", # Textbox's text_color is set when printing. so this is for prevent from non-setting text_color like the gloves used in food factories are blue.
|
||||
wrap="word",
|
||||
height=0,
|
||||
))
|
||||
textbox_widget = getattr(main_window, textbox_setting["textbox_attr_name"])
|
||||
textbox_widget.grid(row=0, column=0, padx=settings.uism.TEXTBOX_PADX, pady=0, sticky="nsew")
|
||||
|
||||
Reference in New Issue
Block a user