Quick & Dirty
#!/usr/bin/env python
import wx
import math
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Test", wx.DefaultPosition,
wx.Size(200, 300))
self.i = 0
self.Buttons = []
self.Panel = wx.Panel(self)
self.Sizer = wx.BoxSizer(wx.VERTICAL)
self.Buttons.append(wx.Button(self.Panel, label="Add Button"))
self.Bind(wx.EVT_BUTTON, self.OnAddButton, self.Buttons[self.i])
self.Sizer.Add(self.Buttons[self.i], 0, wx.ALL, 10)
self.Panel.SetSizer(self.Sizer)
self.Panel.Fit()
self.Fit()
self.Center()
self.Show(1)
def OnAddButton(self, event):
self.i = self.i + 1
self.Buttons.append(wx.Button(self.Panel, label="Button " +
str(self.i)))
self.Bind(wx.EVT_BUTTON, self.OnButton, self.Buttons[self.i])
self.Sizer.Add(self.Buttons[self.i], 0, wx.ALL, 10)
self.Panel.Fit()
self.Fit()
def OnButton(self, event):
Label = event.GetEventObject().GetLabel()
wx.MessageBox(Label, Label, wx.OK|wx.CENTER, None, -1, -1)
def main():
theApp = wx.PySimpleApp()
theApp.SetTopWindow(MyFrame())
theApp.MainLoop()
if __name__ == "__main__": main()
2011/7/14 Mucibirahman İLBUĞA <[email protected]>:
> 14-07-2011 23:26 tarihinde, hal 2000 hal yazdı:
>> Dinamiktan kastınız,
>> Kod ile button vb.. oluşturmak mı ?
>> Yoksa üzerine cursor ile gelindiğinde yanan-söner buttonlar yapmak mı ?
> Merhabalar,
> Mesela bir butona basarak (çalışma anında) ekran üzerinde yeni bir tuş
> veya başka bir widget daha yaratmak...
>
> --
> Kolay gelsin,
> Mucip:)
>
> _______________________________________________
> Linux-programlama mailing list
> [email protected]
> https://liste.linux.org.tr/mailman/listinfo/linux-programlama
> Liste kurallari: http://liste.linux.org.tr/kurallar.php
>
_______________________________________________
Linux-programlama mailing list
[email protected]
https://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php