help with wxSlider & wxPython

S

Scott

I have the code below. I have changed the background of the frame to
white, but I cannot get the wxSlider to not be the ugly gray color.
Can someone tell me how to change it to a transparent background (I
tried wxTRANSPARENT_WINDOW without success)?

import os
from wxPython.wx import *
ID_ABOUT=101
ID_EXIT=110
class MainWindow(wxFrame):
def __init__(self,parent,id,title):
wxFrame.__init__(self,parent,wxID_ANY, title, size = (
800,600),style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
#self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE)
wxStaticText(self, -1, "Distance to Move", (30, 40))
slider = wxSlider(self, 100, 25, 0, 3600, (30, 60), (400,
-1),wxSL_HORIZONTAL | wxSL_TOP | wxSL_AUTOTICKS | wxSL_LABELS |
wxTRANSPARENT_WINDOW)
slider.SetTickFreq(1, 1)
slider.SetValue(1800)
self.CreateStatusBar() # A StatusBar in the bottom of the
window
# Setting up the menu.
filemenu= wxMenu()
filemenu.Append(ID_ABOUT, "&About"," Version 001")
filemenu.AppendSeparator()
filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
# Creating the menubar.
menuBar = wxMenuBar()
menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the
MenuBar
self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame
content.
EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event
ID_ABOUT to the
EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event
ID_EXIT to the
self.SetBackgroundColour(wxWHITE)
self.Show(true)
self.Center(wxBOTH)
def OnAbout(self,e):
d= wxMessageDialog( self, "test","About test", wxOK)
d.ShowModal() # Shows it
d.Destroy() # finally destroy it when finished.
def OnExit(self,e):
self.Close(true) # Close the frame.
app = wxPySimpleApp()
frame = MainWindow(None, -1, "test")
app.MainLoop()

TIA,
Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top