Back to list
Row0902

create-gui-component

by Row0902

0🍴 0📅 Jan 21, 2026

SKILL.md


name: Create GUI Component description: Standards for creating decoupled wxPython components (Panels, Dialogs).

🖥️ GUI Component Creation Skill

Context

wxPython code must be clean, decoupled from logic, and use sizers for layout.

1. Standard Panel Structure

Always inherit from wx.Panel. never put business logic directly here. Use EventBus to talk to services.

import wx
from src.core.events import EventBus, EventType

class MyFeaturePanel(wx.Panel):
    def __init__(self, parent, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        self._init_ui()
        self._bind_events()

    def _init_ui(self):
        # Master Sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Components
        self.btn_action = wx.Button(self, label="Do Item")
        
        # Layout
        main_sizer.Add(self.btn_action, 0, wx.ALL | wx.EXPAND, 5)
        self.SetSizer(main_sizer)

    def _bind_events(self):
        self.btn_action.Bind(wx.EVT_BUTTON, self._on_action)

    def _on_action(self, event):
        # Delegate to Event Bus - DO NOT call Service directly
        EventBus().publish(EventType.USER_ACTION, {"action": "do_item"})

2. Dialog Standard

Use wx.Dialog with standard buttons.

class MyDialog(wx.Dialog):
    def __init__(self, parent, title="My Dialog"):
        super().__init__(parent, title=title)
        self._init_ui()

    def _init_ui(self):
        sizer = wx.BoxSizer(wx.VERTICAL)
        
        # Content
        self.text_input = wx.TextCtrl(self)
        sizer.Add(self.text_input, 0, wx.EXPAND | wx.ALL, 10)

        # Buttons
        btns = self.CreateButtonSizer(wx.OK | wx.CANCEL)
        sizer.Add(btns, 0, wx.EXPAND | wx.ALL, 10)
        
        self.SetSizerAndFit(sizer)

3. Checklist

  • No logic in _on_event methods? (Publish events instead).
  • Used BoxSizer or GridBagSizer? (No absolute positioning).
  • All user-visible strings in English?

Score

Total Score

35/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon