Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Simple shortcut GUI app
Index -> Programming, Python -> Python Submissions
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
QuantumPhysics




PostPosted: Mon Oct 08, 2012 11:01 am   Post subject: Simple shortcut GUI app

I made this last week during school hours, I wanted to make it easier to open websites in our school.
Since shortcuts are blocked and you must go through a certain process to open internet - This will just
skip that process and let me go to the website right away. It's a weird process (our IT guy is strange)

Without further ado, here is the code:

Python:


# Written by: QuantumPhyiscs
# Date Written: 10/03/12

# includes wxWidgets module
import wx
# includes web browser module to access internet
import webbrowser
# Copyright (c) ~ QuantumPhyiscs
class MyFrame(wx.Frame):
    def __init__(self):
        # Sets name of the frame
        wx.Frame.__init__(self, None, wx.ID_ANY, 'Open IE WP',
            pos=(300, 150), size=(207, 175))
        # Sets background color of the frame
        self.SetBackgroundColour("red")
        # Creates a button(1 - 4) at x-x pos, x-y size
        self.button1 = wx.Button(self, id=-1, label='Open Google',
            pos=(8, 8), size=(175, 28))
        self.button1.Bind(wx.EVT_BUTTON, self.button1Click)
        self.button2 = wx.Button(self, id=-1, label='Open Facebook',
            pos=(8, 38), size=(175, 28))
        self.button2.Bind(wx.EVT_BUTTON, self.button2Click)
        self.button3 = wx.Button(self, id=-1, label='Open Moodle',
            pos=(8, 68), size=(175, 28))
        self.button3.Bind(wx.EVT_BUTTON, self.button3Click)
        self.button4 = wx.Button(self, id=-1, label='Open Youtube',
            pos=(8, 98), size=(175, 28))
        self.button4.Bind(wx.EVT_BUTTON, self.button4Click)
        # Makes button visible on frame
        self.Show(True)
    # Tackle events if button is clicked
    def button1Click(self,event):
        # Sets title or super's the frame once button is clicked
        self.SetTitle("Google is open.")
        # Opens default web browser and redirects to google.com
        # Sets new = 1, which means thats a new window will open
        webbrowser.open("www.google.com",new = 1, autoraise = True)
        # Makes button visible on frame
        self.button2.Show()
        # repeats for the rest
    def button2Click(self,event):
        self.SetTitle("Facebook is open.")
       
        webbrowser.open("http://facebook.com",new = 1, autoraise = True)
        self.button1.Show()
    def button3Click(self,event):
        self.SetTitle("Moodle is open.")
     
        webbrowser.open("http://moodle2.yrdsb.ca/login/index.php",new = 1, autoraise = True)
        self.button4.Enable()
    def button4Click(self,event):
        self.SetTitle("Youtube is open.")
        webbrowser.open("www.youtube.com",new = 1, autoraise = True)
        self.button3.Enable()

application = wx.PySimpleApp()
window = MyFrame()
# While loop for application, continues untill window is closed to DESTROY app
application.MainLoop()

Sponsor
Sponsor
Sponsor
sponsor
QuantumPhysics




PostPosted: Tue Oct 09, 2012 3:25 pm   Post subject: Re: Simple shortcut GUI app

So I got many views of my code but no replies, what are your responses to my code? I need all the feedback I can get.
Display posts from previous:   
   Index -> Programming, Python -> Python Submissions
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: