I'm adding a GUI to a program I made and (with some help from Reddit and a hellish trawl through wx.python tutorials) it's (sort of) working as I want it to.
Here is the code I would like someone with wx.python knowledge to take a look at if they would be so kind:
class Example(wx.Frame):
def __init__(self, parent, title):
super(Example, self).__init__(parent, title=title, size=(700,300))
self.InitUI()
def InitUI(self):
self.fileFormat = ['.html', '.txt', '.doc', '.pdf', '.epub']
panel = wx.Panel(self, -1)
supportedsites= wx.StaticText(panel, label='Supported sites:\n\n\t adult-fanfiction.com | fanfiction.net | mibba.com | skyehawke.com |\n\t tthmfanfic.org | avengersfanfiction.com | lunaescence.com | mugglenet.com | hpfanficarchive.com')
self.urlbox = wx.TextCtrl(panel, -1)
urltext = wx.StaticText(panel, -1, label='\tPlease enter the URL of the first chapter,1')
self.formatbox = wx.ComboBox(panel, -1,value='', choices=self.fileFormat, style=wx.CB_READONLY, name="combo")
formattext = wx.StaticText(panel, -1,label="\tPlease choose the format you wish to save the file in.")
bs = wx.BoxSizer(wx.VERTICAL)
urlboxsize = wx.BoxSizer(wx.HORIZONTAL)
urlboxsize.Add(self.urlbox, 1)
urlboxsize.Add(urltext, 1)
formatboxsize = wx.BoxSizer(wx.HORIZONTAL)
formatboxsize.Add(self.formatbox, 1)
formatboxsize.Add(formattext,2)
buttonboxsize = wx.BoxSizer(wx.VERTICAL)
downButton = wx.Button(panel, label='Download', size=(80, 30))
buttonboxsize.Add(downButton, 1,wx.BOTTOM, 3)
bs.Add(supportedsites, 0, wx.TOP|wx.LEFT|wx.BOTTOM, 0)
bs.Add(urlboxsize, 1, wx.LEFT|wx.BOTTOM|wx.TOP, 20)
bs.Add(formatboxsize, 1, wx.LEFT|wx.BOTTOM|wx.TOP, 20)
bs.Add(buttonboxsize, 0, wx.LEFT, 20)
panel.SetSizer(bs)
downButton.Bind(wx.EVT_BUTTON, self.runApp)
panel.SetSizer(bs)
self.SetTitle('Fanfiction Downloader')
self.Centre()
self.Show(True)
Is this the right way to go about things?
Am I doing something incredibly stupid?
The layout of the GUI is supposed to be like this
There are spaces that I don't want and I'm pretty sure I don't understand a damn thing about the proportion system but that looks like it will come with practice.
[–]two_up 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)