how do i create a simple interface with two buttons and a picture in the backgroud in python

Recommended Answers

All 3 Replies

You would use a GUI module such as wxPython to do it. As to not just give you the answer but to point you in the right direction here is a basic frame with one button on it.

import wx

app = wx.App(redirect=False)
frame = wx.Frame(None, wx.ID_ANY,title = "Example")
button = wx.Button(frame,wx.ID_ANY,label = "Click me... but nothing will happen")
app.MainLoop()

perhaps you could find out how to add that other button and for the image you might want to look at this code snippet:
http://www.daniweb.com/code/snippet654.html

If you have any question just post them. :)

thanks paulthom12345 but ive some more difficulties can any1 help

im using python 2.5 and ive installed wxPython2.8-win32-unicode-2.8.9.1-py25
n also im using win XP but still when i write the codes nothing(frame or window) appears
also i wrote the code n saved it as simple.py yet no result

Can i just say, it was my fault, i have an error in my code. Woops.
Please add

frame.Show(True)

just before the app.MainLoop() statement.

That will make the frame show.

Sorry for the error :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.