# class GWidget(GObject, GOrientable):
## 方法
### Init(self)
> 初始化。
### Remove(self, Widget: GObject)
> Widget: `GObject`
>> 子部件 要移除的子部件
> 移除子部件
### Add(self, Widget: GObject):
>
def SetVersion(self, Version: float = 3.0):
from gi import require_version
require_version("Gtk", str(Version))
def GetChildren(self):
return self.Widget.get_children()
def DoRemove(self):
self.Widget.do_remove()
def DoAdd(self):
self.Widget.do_add(widget)
def Activated(self):
self.Widget.activate()
def Destroy(self):
self.Widget.destroy()
def DoDestroy(self):
self.Widget.do_destroy()
def DoDestroyEvent(self, event):
self.Widget.do_destroy_event(event=event)
def DeleteWindow(self, Window):
self.Widget.unregister_window(window=Window.Get())
def DoPressButton(self):
self.Widget.do_button_press_event()
def DoReleaseButton(self):
self.Widget.do_button_release_event()
def GetMarginLeft(self):
self.Widget.get_margin_start()
def GetMarginRight(self):
self.Widget.get_margin_end()
def GetMarginTop(self):
self.Widget.get_margin_top()
def GetMarginBottom(self):
self.Widget.get_margin_bottom()
def Show(self):
self.Widget.show()
def ShowAll(self):
self.Widget.show_all()
def ShowNow(self):
self.Widget.show_now()
def DoShow(self):
self.Widget.do_show()
def DoShowAll(self):
self.Widget.do_show_all()
def Hide(self):
self.Widget.hide()
def DoHide(self):
self.Widget.do_hide()
def SetID(self, ID: int or None):
self.Widget.set_id(id=ID)
def SetWigdet(self, Widget: GObject):
self.Widget = Widget.Get()
def SetStateFlags(self, Flags, Clear: bool = False):
self.Widget.set_state_flags(flags=Flags, clear=Clear)
def SetStateNORMAL(self):
self.SetStateFlags("NORMAL")
def SetStateACTIVE(self):
self.SetStateFlags("ACTIVE")
def SetRilief(self, Rilief: int):
self.Widget.set_relief(Rilief)
def SetParent(self, Parent):
self.Widget.set_parent(parent=Parent.Get())
def SetParentWindow(self, ParentWindow):
self.Widget.set_parent_window(parent_window=ParentWindow.Get())
def SetResizable(self, Resizable: bool):
self.Widget.set_resizable(Resizable)
def SetDefaultSize(self, Width: int, Height: int):
self.Widget.set_default_size(Width, Height)
def SetDefaultWidth(self, Width: int):
self.SetDefaultSize(Width=Width, Height=self.GetDefaultSize()[1])
def SetDefaultHeight(self, Height: int):
self.SetDefaultSize(Width=self.GetDefaultSize()[0], Height=Height)
def SetAngle(self, Angle: int):
self.Widget.set_angle(Angle)
def SetAlpha(self, Alpha: float):
self.Widget.set_opacity(opacity=Alpha)
def SetMiniSize(self, Width: int, Height: int):
self.Widget.set_size_request(width=Width, height=Height)
def SetToolTip(self, Text: str):
self.Widget.set_tooltip_text(text=Text)
def SetToolMarkup(self, IconPos: int = 0, ToolTip: str = ""):
self.Widget.set_icon_tooltip_markup(icon_pos=IconPos, tooltip=ToolTip)
def SetToolTipWindow(self, Window):
self.Widget.set_tooltip_window(custom_window=Window.Get())
def SetName(self, Name: str):
self.Widget.set_name(name=Name)
def GetName(self):
"""
:return: int
"""
self.Widget.get_name()
def GetAlpha(self):
return self.Widget.get_opacity()
def GetResizable(self):
return self.Widget.get_resizable()
def GetDefaultSize(self):
return self.Widget.get_default_size()
def GetRelief(self):
return self.Widget.get_relief()
def AddEvent(self, Func):
self.Widget.connect("add", Func)
def Get(self):
return self.Widget