Sunday, October 28, 2018

Calling a wxpython GUI class from another class

First create a python file and save it e.g noname.py and have your wx code in it:

import wx

class MyFrame(wx.Frame):

    def __init__(self, parent , id, title):
        wx.Frame.__init__(self, parent , id, title)
        self.panel = wx.Panel(self,-1)
        

create another python file and have the following code in it, save it as testing .py

import wx
from noname import MyFrame

app = wx.App()

f = MyFrame(None, -1, "MAIN FRAME")
f.Show()

app.MainLoop()


Now anytime at all you run the file testing.py, the GUI should be created.

No comments:

Post a Comment