|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
wx classes
i have the following class:
Code:
#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
# generated by wxGlade 0.3.5.1 on Sat Nov 13 21:09:35 2004
import wx
class NotebookFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: NotebookFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
# Menu Bar
self.frame_1_menubar = wx.MenuBar()
self.SetMenuBar(self.frame_1_menubar)
wxglade_tmp_menu = wx.Menu()
wxglade_tmp_menu.Append(wx.NewId(), "New", "", wx.ITEM_NORMAL)
self.frame_1_menubar.Append(wxglade_tmp_menu, "File")
# Menu Bar end
self.frame_1_statusbar = self.CreateStatusBar(1, 0)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: NotebookFrame.__set_properties
self.SetTitle("frame_1")
self.frame_1_statusbar.SetStatusWidths([-1])
# statusbar fields
frame_1_statusbar_fields = ["My first GUI program - orgasmic!"]
for i in range(len(frame_1_statusbar_fields)):
self.frame_1_statusbar.SetStatusText(frame_1_statusbar_fields[i], i)
# end wxGlade
def __do_layout(self):
# begin wxGlade: NotebookFrame.__do_layout
self.Layout()
# end wxGlade
# end of class NotebookFrame
what code do i need to initialise this to show my GUI? thanks. |
|
#2
|
|||
|
|||
|
Hi!
Code:
class OrgasmicApp(wx.App):
def OnInit(self):
nf = NotebookFrame(None,-1,"")
nf.Show(True)
self.SetTopWindow(nf)
return True
app = OrgasmicApp(0)
app.MainLoop()
Regards, mawe |
|
#3
|
|||
|
|||
|
cheers - worked fine. This really is incredible, i mean the combination of software like python, wxpython, wxglade and py2exe (which i have yet to use), makes commercial software development by individuals so much more realistic. I made my first java gui after 6 months of learning java, and it was ****e also. I haven't even learnt python (i decided to take a look a week ago), it just seems so obvious.
|
|
#5
|
||||
|
||||
|
The GUI demo looks nice and complex
![]() Can't see why wxPython can't cope - the actual GUI stuff is in C libraries anyway. You might consider creating all objects and withdrawing what you don't need. I mean; perhaps you should avoid creating widgets on events. grimy
__________________
*** Experimental Python Markup CGI V2 *** |
|
#6
|
|||
|
|||
|
Quote:
what does this mean? infact - what are widgets? i have never programmed python / guis before |
|
#7
|
||||
|
||||
|
Buttons, frames, windows, dropdown lists, checkboxs, text labels are examples of visible widgets - what widgets you have access to depends on the graphics library you are using.
Events happen when you click a button, hit a key, resize a window etc. To each event you can register one or more functions to be called when that event happens. Again, what events can be generated and how they are done is graphics library dependent. This web-page form has a submit button widget - when clicked the submit form event (or something like that) is raised and code to process the form is called... My comment was about this: In general terms you have two extreme ways to build your GUI. Imagine a GUI application to sell houses done two ways: 1. Build every window and user interface widget at the start of your program but do not makes them visible. This would mean every window is pre built before the user needs it. So when the user clicks a button to add a new record the application just shows the pre-built add record window. When the user clicks Save, the date is read from the fields and the window is withdrawn (made invisible). 2. Build the windows and widgets as needed based on events. For example - when the user clicks a button to add a new record you call the code to build a window and the entry fields and the buttons etc to show a record entry window. When the user clicks Save the data is read from the fields and the window and its widgets are destroyed. Most small applications would use method 2, larger apps with complex GUIs that take lots of processing to create will probably use a mix of 1 and 2. Dig a out a tutorial and get comfortable with your chosen graphics toolkit ![]() grimy |
|
#8
|
|||
|
|||
|
First I used VB but it had limited features so I did a search on the internet “VB vs” then I found Python, I already know that it was a much like Perl. So I tried it out using Tkinter I was so impressed. Then I found about wxWindows I tried many of demos the text widget alone is so bloated full of features.
I did have a small problem running Notebook widget on windows, but I found help on net. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > wx classes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|