Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:34:51+00:00 2026-06-06T17:34:51+00:00

How would I add a link to my menu item in wxpython? What I

  • 0

How would I add a link to my menu item in wxpython? What I want is when the user clicks the menu item it will go to my website. Is this even possible?

Thanks in advance!! Oh and I am fairly new to programming and to python so if you could dumb it down alittle that would be appreciated!! Thanks

THIS IS MY CODE:

    import wx

class MainWindow(wx.Frame):

    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Python Test App',size=(600,400))
        panel=wx.Panel(self)
        wx.Frame.CenterOnScreen(self)
        self.SetBackgroundColour(wx.BLACK)

    ##MENU AND STATUS BAR
        status=self.CreateStatusBar()
        menubar=wx.MenuBar()
        file_menu=wx.Menu()
        help_menu=wx.Menu()

        ID_FILE_NEW = 1
        ID_FILE_EXIT = 2

        ID_HELP_ABOUT = 3
        ID_HELP_WEB = 4


        file_menu.Append(ID_FILE_NEW,"New Window","This will open a new window")
        file_menu.Append(ID_FILE_EXIT,"Exit","This will exit the program")

        help_menu.Append(ID_HELP_ABOUT,"About","This will tell you about %name%")
        help_menu.Append(ID_HELP_WEB,"Visit Website","This will take you to worm-media.host56.com")


        menubar.Append(file_menu,"File")
        menubar.Append(help_menu,"Help")
        self.SetMenuBar(menubar)

        self.Bind(wx.EVT_MENU, self.newWin, None, 1)
        self.Bind(wx.EVT_MENU, self.close, None, 2)
        self.Bind(wx.EVT_MENU, self.about, None, 3)
        ##self.Bind(wx.EVT_MENU, self.web, None, 4)

        heading = wx.StaticText(panel, -1, 'Welcome to My App', (144,10))
        heading.SetForegroundColour(wx.RED)
        font1 = wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        heading.SetFont(font1)


    def newWin(self, event):
        self.new = NewWindow(parent=None, id=-1)
        self.new.Show()

    def close(self, event):
        box=wx.MessageDialog(None, 'Are you sure you want to exit?', 'Exit program?', wx.YES_NO)
        answer=box.ShowModal()
        if answer==wx.ID_YES:
            self.Destroy()

    def about(self, event):
        self.new = AboutWindow(parent=None, id=-1)
        self.new.Show()

    ##def web(self, event):


class NewWindow(wx.Frame):

    def __init__(self,parent,id):
        wx.Frame.__init__(self, parent, id, 'New Window', size=(400,300))
        wx.Frame.CenterOnScreen(self)
        ##panel2=wx.Panel(self)
        name_text = wx.StaticText(self, -1, 'What is your name?')
        name = wx.TextCtrl(self, -1, '', (100,0))
        font2 = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        name_text.SetFont(font2)


class AboutWindow(wx.Frame):

    def __init__(self,parent,id):
        wx.Frame.__init__(self, parent, id, 'About', size=(300,190))
        wx.Frame.CenterOnScreen(self)
        self.SetBackgroundColour(wx.WHITE)
        about_bg = 'about_bg.jpg'
        bmp1 = wx.Image(about_bg, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.bitmap1 = wx.StaticBitmap(self, -1, bmp1, (0,0))

        ##ABOUT_TEXT
        by_text =  wx.StaticText(self, -1, 'Made By: Worm', (50,70))
        version_text = wx.StaticText(self, -1, 'Version: 1.0', (50,90))
        website_text = wx.StaticText(self, -1, 'Website: worm-media.host56.com', (50,110))

        ##ABOUT_FONTS
        by_font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        version_font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        website_font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL)

        by_text.SetFont(by_font)
        version_text.SetFont(version_font)
        website_text.SetFont(website_font)


        ##ABOUT_COLORS
        by_text.SetBackgroundColour(wx.WHITE)
        version_text.SetBackgroundColour(wx.WHITE)
        website_text.SetBackgroundColour(wx.WHITE)


##RUN##

if __name__=='__main__':
        app=wx.PySimpleApp()
        frame=MainWindow(parent=None,id=-1)
        frame.Show()
        app.MainLoop()

This is my code so far. I really haven’t tried anything with this because I’m not even sure where to start. I tried looking how to do this online and came up empty. I guess all I’m asking is how to make a link in python to my website from the menu bar under about/Visit Website.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:34:52+00:00Added an answer on June 6, 2026 at 5:34 pm

    The functionality you want is actually built into Python. Check the webbrowser API. Specifically, look at the webbrowser.open() function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to add track code for each link of in my email
I want to stringify a number and add zero-padding, like how printf(%05d) would add
Do You have any idea how to easily add a menu link Change Your
I'm creating menu and I would like to link my menu items to Spring
I want to make a menu that.. does this: http://jsfiddle.net/8U9fy/1/ ( didnt want to
I would like to add a link in my javascript messagebox function. Is there
I would like to add code to a menu by modifying the Joomla mod_mainmenu
I'm making a menu and I would like to add class=selected to the active
I'd like to write a gmail extension that would add a button on the
I'm using Elmah with ASP.NET and wondering how I would add custom data, such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.