[[oktatas:programozás:python:wxpython_gui|< wxPython GUI]]
====== wxPython Panel ======
* **Szerző:** Sallai András
* Copyright (c) Sallai András, 2020, 2021
* [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]]
* Web: https://szit.hu
===== Panel használata =====
Panel Példa:
import wx
class MainFrame(wx.Frame):
def __init__(self, parent):
super().__init__(parent)
self.initUI()
self.initLayout()
def initUI(self):
self.panel1 = wx.Panel(self)
self.textCtrl1 = wx.TextCtrl(self.panel1)
self.button1 = wx.Button(self.panel1, label='Mehet')
def initLayout(self):
rootBox = wx.BoxSizer(wx.HORIZONTAL)
rootBox.Add(self.textCtrl1)
rootBox.Add(self.button1)
self.panel1.SetSizer(rootBox)
class SimpleApp(wx.App):
def OnInit(self):
frame = MainFrame(None)
frame.Show()
return True
app = SimpleApp()
app.MainLoop()
===== Külön osztály =====
import wx
class ValamiPanel(wx.Panel):
def __init__(self, parent):
super().__init__(parent)
self.initUI()
self.initLayout()
def initUI(self):
pass
def initLayout(self):
pass
===== Kicsi minta =====
import wx
class Panel1(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
btn = wx.Button(self, label='Mehet')
app = wx.App()
frame = wx.Frame(None, -1, 'Egy gomb', size=(400, 300))
Panel1(frame, -1)
frame.Show()
app.MainLoop()