473,654 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Skinnable/Stylable windows in wxPython?

I'm very near finishing a medium to large scale application, so I'm
getting a head start on the GUI side of things. Part of the concept is
to give as much attention to presentation as functionality, and
something I really wanted to do was transcend the basic window and
style it to an extent,

To be honest, the wxPopupWindow was basically what I was looking for,
but it isn't available on Mac, eliminating that possibility.
wxShapedWindow would have sufficed, but it uses a more recent version
wxPython that I've chosen not to install for various dependency
issues, so I really can't use that.

I've combed through the demo countless times, but I really can't find
any answers. So, the question: what is the best way (or is there one,
rather) to achieve an end comparable to skinning my wx windows?

Thanks for your help,
Daniel Bickett
Jul 18 '05 #1
5 4415
Hello Daniel,
The wxPopupWindow is also missing several things that would make it
suitable for a frame, like accelerator events. I built a 'chromeless'
picture viewer once using wxPopupWindow and it worked , but it was
missing things I needed because of missing functionality in
wxPopupWindow. IMHO is isn't intended to be used as a full featured
frame.
The only way *I* know how to skin an app in wxWindows is using
wxShapedWindow .wxShapedWindow just changes the frame shape, you then
need to render a background picture and then place elements on that
background for buttons and other controls, you also will have to
implement functionality for those elements so they work like normal
controls, plus a hundred other gotchas.
Skinning is a pain ,and to do it right you probably need to use a
'DoubleBuffered Dc' so your elements won't flicker when you click or
move them. I started writing a generic skinner class that does the hard
stuff but when I tested found that it needed to be rewritten using a
DoubleBefferedD C. Maybe someday...
Hope any of this helps maybe others have diffrent ideas.
M.E.Farmer

Jul 18 '05 #2
Solution found!

For the future reference of anyone searching:

The wxPopupWindow can easily be achieved by creating a wxMiniFrame
with absolutely no styles ('0', explicitly). The features of the
wxPopupWindow in the wxPython demo don't come with it, they were
manually added in the demo code, so simply adapting the code should
suffice.

Even as I was typing this message, I realized that this was probably
exactly what wxPopupWindow was, and suddenly this clicked because I
remembered seeing in the wxWindows help files that all of the styles
for wxMiniFrame only worked on Windows and Motif, and it made a point
to note that they didn't work on GTK. So I tried a snippet of code[1]
on my Mac (until then I had been working on a windows box) and, to my
surprise, it worked perfectly.

This raises some questions for me, like why, if the wxPython package
is going to have the wxPopupWindow feature, they don't simply inherit
wxMiniFrame like I did (quite literally, it looks /exactly/ the same
as a wxPopupWindow). Not only would this make it more multi-platform
(I have no access to a GTK machine so I don't know if this works.
Could someone please check?), but it would be more useful, considering
the fact that it is in fact a frame, and wouldn't have the problems
that M.E.Farmer outlined above regarding controls on wxPopupWindows.

Regardless, I'm happy that I've uncovered the answer, and I hope this
helps someone else in the same situation :)

Daniel Bickett

NOTES:
[1] from wxPython.wx import wxMiniFrame, wxPySimpleApp
app = wxPySimpleApp()
frame = wxMiniFrame( None , -1 , '' , size = ( 300 , 150 ) , style = 0 )
frame.Show()
app.MainLoop()
Jul 18 '05 #3
Daniel Bickett wrote:
Solution found!

Not only would this make it more multi-platform (I have no access to
a GTK machine so I don't know if this works. Could someone please
check?)


Looks like it works (I had to change frame.Show() to frame.Show(1)
though, but that could be because it's an old version). One odd thing
though: the Windows version doesn't react to clicking or dragging the
mouse, which seems to be the expected behavior. The GTK version can be
moved by dragging the mouse; even just clicking the mouse moves the
window somewhat down and to the left.

--
"Codito ergo sum"
Roel Schroeven
Jul 18 '05 #4
> > Not only would this make it more multi-platform (I have no access to
a GTK machine so I don't know if this works. Could someone please
check?)
Looks like it works (I had to change frame.Show() to frame.Show(1)
though, but that could be because it's an old version).


No, I think that was a slip on my part when copying the code from one
screen to the next :)
One odd thing
though: the Windows version doesn't react to clicking or dragging the
mouse, which seems to be the expected behavior.
I noted in my second post that the functionality of the window
(clicking and dragging et al) was, even in the wxPopupWindow demo,
implemented by using the EVT macros. Copied from the demo, the code is
as follows:

def OnMouseLeftDown (self, evt):
self.ldPos = evt.GetEventObj ect().ClientToS creen(evt.GetPo sition())
self.wPos = self.GetPositio n()
self.CaptureMou se()

def OnMouseMotion(s elf, evt):
if evt.Dragging() and evt.LeftIsDown( ):
dPos = evt.GetEventObj ect().ClientToS creen(evt.GetPo sition())
nPos = (self.wPos.x + (dPos.x - self.ldPos.x),
self.wPos.y + (dPos.y - self.ldPos.y))
self.Move(nPos)

def OnMouseLeftUp(s elf, evt):
self.ReleaseMou se()

def OnRightUp(self, evt):
self.Show(False )
self.Destroy()
The GTK version can be
moved by dragging the mouse; even just clicking the mouse moves the
window somewhat down and to the left.


That's interesting... I wonder if using those methods would conflict
at all. Also, while I'm on that note, when double clicking on the
resulting window (after binding those events), double click causes a
non-fatal, yet annoying, traceback saying that "the mouse could not be
released because it has not yet been caught blah blah", so I just
wrapped the contents of OnMouseLeftUp in a try..except..pa ss.

Daniel Bickett
Jul 18 '05 #5
Daniel Bickett wrote:
Not only would this make it more multi-platform (I have no access to
a GTK machine so I don't know if this works. Could someone please
check?)


Looks like it works (I had to change frame.Show() to frame.Show(1)
though, but that could be because it's an old version).

No, I think that was a slip on my part when copying the code from one
screen to the next :)


I tried again with newer versions (Python 2.3 and wxPython 2.4); the
code runs as-is, without that modification.
One odd thing
though: the Windows version doesn't react to clicking or dragging the
mouse, which seems to be the expected behavior. The GTK version can be
moved by dragging the mouse; even just clicking the mouse moves the
window somewhat down and to the left.

That's interesting... I wonder if using those methods would conflict
at all.


I couldn't reproduce that behaviour this time. It might have had
something to do with the test setup the first time.

--
"Codito ergo sum"
Roel Schroeven
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
7748
by: Vamsi Mudrageda | last post by:
I am kind of new to Python, and after trying and using wxPython, I found it kind of lacking in easy-to-read documentation, speed at loading, and GUI response-time. So I am looking for an another GUI toolkit that is cross-platform for Python, and am leaning toward PyQt (PyGTK is kind of dull looking in comparison). Unfortunately, although TrollTech says Qt is cross-platform, its license strategy has me a bit confused. So here is to...
4
1912
by: Zach Shutters | last post by:
I am new to python and working my way through the van Rossum tutorial. I am cursios though about if you can program windows with python? I know I shouldn't worry about this right now but I am curious. If so, is there any recommended tutorials on this. I know I can search google but i figured I would see what some people who know the language well would recommend. One last thing, in order for a program I write in python to run on someones...
13
4582
by: Peter Maas | last post by:
Recently I replaced Win2k with Linux on my desktop computer. Using mostly multi-platform software I thought this would be easy. It was not as easy as expected getting wxPython to work. There seemed to be no SuSE RPM so I installed from source. Here are my steps (gtk 2.4 was already installed): - Built wxWidgets (.configure --enable-unicode) - Built wxPython (python setup.py install) error: "you should use wx-config program for...
7
1882
by: Bob Swerdlow | last post by:
Anyone have opinions about whether we will be better off using PythonNet or wxPython for the GUI layer of our application on Windows? Our code is all Python and is now running on Mac OS X with PyObjC and Cocoa, which works very well. Our goal is not necessarily to move to a cross-platform solution, but rather to create a solid Windows version that looks and feels like a native application. All the code that interacts with the user is...
1
284
by: Ben | last post by:
Hi, I'm interested in making an application I'm about to start writing skinnable, but I have absolutely no idea where to begin. If anyone has a broad overview of how I would go about it or some links to resources that might help it would be much appreciated. Are there any free libraries I should look at too (I am a student developer, so paying isn't an option!)? I might settle for simply having a custom interface rather than it...
25
4272
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you can use PyGTK. (...)", July 2nd, 1999 pyGTK on Windows "(...) > can i use pyGTK under > Windows???
0
1337
by: Andrew Clancy | last post by:
Hi, I'm hoping to create a skinnable user control in ASP.Net, using the skin file to keep things streamlined & all in one place/technique. 1st attemp went something like this Test.ascx: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Test.ascx.cs" Inherits="Test" EnableTheming="true" %><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Button ID="Button1" runat="server" Text="Button" />
1
1220
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, Is there anybody who has made A VB6 form fully skinnable, meaning you can change titlebar and borders and some more special things with labels frames buttons etc? But one thing remember skinnable form without using any software.
2
4247
by: timw.google | last post by:
The subject line says it all. Is there a way to install wxPython on a Windows machine without admin privs? I love the way python doesn't need admin to install locally, and I'd like to try wxPython w/o having to get our help desk involved. Do I have to compile it from source with Cygwin? Thanks.
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.