wxPython - How to implement a colour slider - slider

for my project I want to implement a colour slider such as the one in the ColourCubeDialog or in Windows' native colour picker dialog. Here are some pictures to illustrate what I mean:
https://www.codeproject.com/KB/WPF/WPFColourSlider/WpfColourSlider1.jpg
https://www.codeproject.com/KB/miscctrl/XColorSpectrumCtrl/XColorSpectrumCtrl4.png
I found the wx.lib.colourchooser.pycolourslider.PyColourSlider while digging around in the wx package and I thought I could use that to implement the colour slider. I tried it the following way, but it only shows a white square (approx. 15 pixels) surrounded by a thin black border in the upper left hand corner.
import wx
from wx.lib.colourchooser.pycolourslider import PyColourSlider
app = wx.App()
frame = wx.Frame(None, -1, title="PyColourSlider",style=wx.MINIMIZE_BOX|
wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX|wx.RESIZE_BORDER)
panel = wx.Panel(frame)
slider = PyColourSlider(panel, -1)
slider.SetBaseColour(wx.Colour(80, 100, 120)) # some random color
slider.DrawBuffer()
frame.Show()
app.MainLoop()
What am I doing wrong? Is the PyColouSlider the right way to go or is there a better approach?

I found something that is not the ultimate answer to my own question, but it helped me.
The from wx.lib.colourchooser. folder contains lots of parts that, when put together, allow the user to create an entire colour picker. There is even an implementation of a complete colour picker that can be embedded in a window/frame/whatever. It's called pycolourchooser.

Related

Multiple Stages on Same screen with different viewport LIBGDX

I am trying to scale my application to work similar on various aspect ratios.
I read about viewport and camera. And came to a conclusion that I should use FitViewport for my game stage so that no asset is being stretched. And I will use some background image to fill the black bars caused by fitviewport. But the problem is, whenever I use any other viewport than FitViewport for background image, the whole stage (both background and main stage) are being stretched, is there a way we can get away from black/white bar of FitViewport? I tried all the viewports for background namely StretchViewport, ScreenViewport, FillViewport.
Am I missing something very trivial? or is setting up multiple different viewport on same screen possible.
ps I was able to setup two same viewports with different size on same screen.
Here is the screen, I am getting after fitviewport. Notice the white bars on top and bottom which I am trying to eliminate.
this answer worked for me. Just for reference
You would need a second viewport, probably ExtendViewport with the
same virtual dimensions as your FitViewport.
//create:
fitViewport = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
extendViewport = new ExtendViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
//resize:
fitViewport.update(width, height);
extendViewport.update(width, height);
//render:
fitViewport.apply();
batch.setProjectionMatrix(fitViewport.getCamera().combined);
batch.begin();
//draw game
batch.end();
extendViewport.apply();
batch.setProjectionMatrix(extendViewport.getCamera().combined);
batch.begin();
//draw stuff in border
batch.end();
If you want to be sure the border stuff doesn't overlap your game, you
could swap the draw order above.
Or you could just use ExtendViewport to begin with for everything.

Filling in Hollow Area Only for Bootstrap Glyphicon

I'm using Bootstrap glyphicons for a web app and love the flexibility of being able to leverage them as fonts, since that's what they are, not graphics. However, I'm running into a challenge with the glyphicon-remove-sign icon, which has a colored circle surrounding an otherwise empty "x". I like the default look of the black surrounding the "x" and want to use it to close a rounded-cornered iframe. But, because that "x" is empty, it displays whatever is behind it:
Ideally, I'd want to have that hollow "x" be a different color like white, easy enough to do with background colors, except that creates a box around the otherwise vectored font and looks unsightly for my usage, which has multiple colors to contend with behind the icon:
The question is: is there a way to just fill in the empty space inside the hollow area of this glyphicon without this kludgy-looking box? I looked at using a clip-path with the background color, but that won't work with IE. I welcome any recommendations anyone may have for a fix here -- thanks in advance.
create a wrapper div of the glyphicon, give it border-radius as to imitate the circle streching it and then give that background color

How to revert back to not require rasterize

I used to be able to color any Text, shape, or image by just selecting the particular layer and use pain bucket tool for example. Not sure what I clicked, but recently when I try to do the same; I always get the following message:
"This type Layer must be rasterized before proceeding. Its text will
no longer be editable. Rasterize the type? "
I do not want to rasterize. Can I know how to revert back to the normal setup where I can do the coloring without the need for rasterize please.
It also seems to mess around with my selection.
For example - I have a circle shape in the middle with transparent background.
I used to be able to go Select>All followed by Select>Inverse and it will select the circle shape.
But now it selects the entire canvas when I select all but returns the following error when I Select>Inverse
"Warning No Pixels were selected".
You may not be able to color a vector object with paint bucket tool. Instead, can you try using the color option in the blending mode. That will retain the vector property and also apply the color.
The following applies to PS-CS6
In the layers palette,
= Right click on the layer > Blending Options > Select Color Overlay

Custom Titlebar in a Cocoa Application

I need to create a (very) custom titlebar in a cocoa app. I read about the INAppStoreWindow library, but it seems it doesn't have the feature that I need. So here's what I have need to do (see image for clarification):
My titlebar is the thing between the green and red circle
The text (Text1 - Text3) are all images
The black circle with the exclamation mark is also an image
The grey area below the title bar is a webview. It expands from the left border all the way to the right edge of the reddish sidebar. (This is actually where why I think that the INAppStoreWindow won't work, as I cannot specify a width for the title bar)
The images should have an Action
Text1 through Text3 as well as the black circle load some URL into the webview
Red circle closes the app
My app has no borders and no shadows. Right know in order to be able to move the app I drew a Box element at the top where the title bar should be. I think I can draw something in it as well, but as I'm very knew to cocoa development here are my questions:
How can I draw some images in the Box element?
Is there a better element to draw the titlebar in?
I know that are two questions, but they are closely relatated. It's generally: How to draw a simple titlebar like this?
As the problem inside the titlebar is the same for every item I need to draw (they are all images) I belive there is a quite simple solution for that, but because I lack the experience of how to solve this I'd need your help. You can also point me the the right direction in the comments and I'll answer this question myself after I've got it right.

Is UITabBar's Icon must be monochrome?

It seems that all color except transparency count as one color. If I use this pictures, all I get is a big box and only the first 2 lines are drawn.
What do do if we want colourful tab bar icons then?
Note: If I use the image above, what I get is this:
There isn't anyway to make colorful tab bar icons isn't it? Where is this documented anyway?
Yes, the image you use for a custom tab bar icon is just used as a mask to create the icon you will see when the app runs. It should be white with appropriate alpha trasparency. This is documented here: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html