Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 13th, 2004, 04:18 PM
bannedalot bannedalot is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 25 bannedalot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old November 13th, 2004, 04:33 PM
mawe mawe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 394 mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 10 h 6 m 47 sec
Reputation Power: 46
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

Reply With Quote
  #3  
Old November 14th, 2004, 08:06 AM
bannedalot bannedalot is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 25 bannedalot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old November 17th, 2004, 04:38 AM
bannedalot bannedalot is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 25 bannedalot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i have yet to program a full GUI using wxpython, how does it perform speed wise? the gui i am making will be similar to this

Reply With Quote
  #5  
Old November 17th, 2004, 10:08 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
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 ***

Reply With Quote
  #6  
Old November 17th, 2004, 11:10 AM
bannedalot bannedalot is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 25 bannedalot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by Grim Archon
The GUI demo looks nice and complex
perhaps you should avoid creating widgets on events.


what does this mean? infact - what are widgets? i have never programmed python / guis before

Reply With Quote
  #7  
Old November 17th, 2004, 12:32 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
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

Reply With Quote
  #8  
Old November 17th, 2004, 02:19 PM
Tkinter_Bell Tkinter_Bell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Isle of dogs
Posts: 68 Tkinter_Bell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > wx classes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT