アットウィキロゴ

wx.Window

wx.Window

wx.Winow

wx.Window is a base class out of which many widgets inherit. For instance, the wx.Frame widget inherits from wx.Window. Technically it means that we can use wx.Window's methods for all descendants. We will introduce here some of it's methods.

wx.Window は多くのウィジットが内部で継承する基本となるクラスである。 例えば、wx.Frame ウィジットは wx.Window を継承している。技術的いうと、全ての子クラスがwx.Windowのメソッドを使うことができる事を意味している。 ここでその幾つかのメソッドを紹介する。

-SetTitle(string title) - Sets the window's title. Applicable only to frames and dialogs.

  • SetTitle(string title) - ウインドウのタイトルを指定する。フレームとダイアログのみ。

-SetToolTip(wx.ToolTip tip) - Attaches a tooltip to the window.

  • SetToolTip(wx.ToolTip tip) - ツールチップをウインドウに結びつける。

-SetSize(wx.Size size) - Sets the size of the window.

  • SetSize(wx.Size size) - ウインドウサイズを指定する。

-SetPosition(wx.Point pos) - Positions the window to given coordinates

  • SetPosition(wx.Point pos) - ウインドウの位置を指定する。同等な値を与えること。

-Show(show=True) - Shows or hides the window. show parameter can be True or False.

  • Show(show=True) - ウインドウを表示したり隠したりする。引数は True か False。

-Move(wx.Point pos) - Moves the window to the given position.

  • Move( wx.Point pos ) - ウインドウを移動する。位置を与えること。

-SetCursor(wx.StockCursor id) - Sets the window's cursor.

  • SetCursor(wx.StockCursor id) - ウインドウのカーソルを指定する。
  1 #!/usr/bin/python
  2 
  3 # simple2.py
  4 
  5 import wx
  6 
  7 app = wx.App()
  8 
  9 frame = wx.Frame(None, -1, '')
 10 frame.SetToolTip(wx.ToolTip('This is a frame'))
 11 frame.SetCursor(wx.StockCursor(wx.CURSOR_MAGNIFIER))
 12 frame.SetPosition(wx.Point(0,0))
 13 frame.SetSize(wx.Size(300,250))
 14 frame.SetTitle('simple2.py')
 15 frame.Show()
 16 
 17 app.MainLoop()

We create a 'This is a frame' tooltip. The cursor is set to a magnifier cursor. Possible cursor id's: are listed below

We position the window to the upper left corner and size it to 300x250 pixels. Title is set to 'simple2.py'.

'This is a frame' というツールチップを作成した。カーソルは虫眼鏡を指定。利用可能なカーソルのidはこちら

ウインドウの位置は左上の角を、サイズは300×250ピクセルとした。タイトルは'simple2.py'である。

最終更新:2009年01月15日 16:10