'Wx overlay frame how to put text or image
I make a application that show me a little square of overlay with wx. and i hide it when something happen with Hide(). How i can write inside or put a image inside this box?
import wx
class Skill(wx.Frame):
def __init__(self,xsize, ysize, xposition, yposition, color):
style = ( wx.CLIP_CHILDREN | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR |
wx.NO_BORDER | wx.FRAME_SHAPED )
wx.Frame.__init__(self, None, style = style)
self.SetSize( xsize, ysize)
self.SetPosition( (xposition,yposition))
self.SetBackgroundColour(color)
app = wx.App()
posizioneStart = 400
skill1 = Skill (50,50,650,posizioneStart,"white")
while True:
skill1.Show()
Solution 1:[1]
How about that?
import wx
class Skill(wx.Frame):
def __init__(self, xsize, ysize, xposition, yposition, color):
style = ( wx.CLIP_CHILDREN | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR |
wx.NO_BORDER | wx.FRAME_SHAPED )
wx.Frame.__init__(self, None, style = style)
self.SetSize( xsize, ysize)
self.SetPosition( (xposition,yposition))
self.SetBackgroundColour(color)
sb = wx.StaticText(self, style=wx.NO_BORDER)
sb.LabelText = "Hello"
sb.Centre()
app = wx.App()
posizioneStart = 400
skill1 = Skill (50,50,650,posizioneStart,"white")
skill1.Show()
app.MainLoop()
This puts the text "Hello" in the center of the box. Similarly, you could insert an image into the wx.StaticBox.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Martin Finke |