hey i'm currently working on a simple rpg in python.
First i was gonna make it text-based but now i've read the wxpython tutorial and i want to try an create a GUI for it. My sister is gonna make some artwork for me (i'm not good at that kind of things). So now i was wondering how i could add a image to a window and also be able to put other things in the window. I know you can use a static bitmap but i don't always know exactly were to place it so that it doesn't show over some other stuff and if i try creating another panel to show it on the whole thing dissapears. this is de code i currently have and i would like to add an image on top of the window.
import wx
class GevechtFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title = "mijn rpg 1.0", pos = (200,75),
size = (WINDOW_WIDTH,WINDOW_HEIGHT))
self.background = wx.Panel(self)
#the text arena
self.textArea = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.TE_MULTILINE)
self.textArea.SetValue(""" just a lot of text displaying details about the monster and the hero so i needs some space""")
#some buttons to attack or use an item or change weapon
self.aanvalButton = wx.Button(self.background, label = "val aan")
self.veranderButton = wx.Button(self.background, label = "verander van wapen")
self.voorwerpButton = wx.Button(self.background, label = "gebruik een voorwerp")
self.specialeButton = wx.Button(self.background, label = "doe een speciale aanval")
self.vluchtButton = wx.Button(self.background, label = "vlucht")
self.vluchtButton.Bind(wx.EVT_BUTTON, self.vlucht_event)
#putting everything into boxes = creating the layout
self.HorizontalBox1 = wx.BoxSizer()
self.HorizontalBox1.Add(self.textArea, proportion = 1, flag = wx.EXPAND, border = 0)
self.HorizontalBox2 = wx.BoxSizer()
self.HorizontalBox2.Add(self.aanvalButton, proportion = 1, flag = wx.EXPAND, border = 0)
self.HorizontalBox2.Add(self.veranderButton, proportion = 1, flag = wx.EXPAND, border = 0)
self.HorizontalBox3 = wx.BoxSizer()
self.HorizontalBox3.Add(self.voorwerpButton, proportion = 1, flag = wx.EXPAND, border = 0)
self.HorizontalBox3.Add(self.specialeButton, proportion = 1, flag = wx.EXPAND, border = 0)
self.HorizontalBox4 = wx.BoxSizer()
self.HorizontalBox4.Add(self.vluchtButton, proportion = 1, flag = wx.EXPAND, border = 0)
self.verticalBox = wx.BoxSizer(wx.VERTICAL)
self.verticalBox.Add(self.HorizontalBox1, proportion = 1, flag = wx.EXPAND, border = 0)
self.verticalBox.Add(self.HorizontalBox2, proportion = 0, flag = wx.EXPAND, border = 0)
self.verticalBox.Add(self.HorizontalBox3, proportion = 0, flag = wx.EXPAND, border = 0)
self.verticalBox.Add(self.HorizontalBox4, proportion = 0, flag = wx.EXPAND, border = 0)
#showing it
self.background.SetSizer(self.verticalBox)
self.Show()
#just to exit the frame it goes back to the mainframe
def vlucht_event(self,event):
self.Destroy()
MainFrame()