I emailed Jon about getting Tkinter installed into Sublime (manually) but after half an hour I couldn’t get it to work. Too many dependencies. And I’m not a Python developer by trade
Color picker - color insertion
[quote=“jbrooksuk”]
I emailed Jon about getting Tkinter installed into Sublime (manually) but after half an hour I couldn’t get it to work. Too many dependencies. And I’m not a Python developer by trade [/quote]
If you have a standard Python installation on you computer, why not directly calling a colorpicker from it ?
Look at Python2x\Tools\pynche\pyColorChooser.py for an example.
You could make a plugin that call the colorpicker and get the value back using stdout output (print) or clipboard.
Note that any colorpicker software that could copy the result to the clipboard work for this task.
i think a colour pallet would be great
something similar to text mate for the mac, so could have transparent background etc would look great!!
I uploaded my plugin to GitHub, so you can install it with the Package Manager plugin by wbond.
Every now and then I still play around with the Tkinter stuff and an actual color picker. Shame it doesn’t always work.
Somebody might want to play with this.
I keep getting this error:
Reloading plugin C:\Users\James.Brooks\AppData\Roaming\Sublime Text 2\Packages\Color Picker\color_picker.py
Traceback (most recent call last):
File ".\sublime_plugin.py", line 61, in reload_plugin
File ".\color_picker.py", line 3, in <module>
import Tkinter
File ".\Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
Directions from Jon:
[code]* Copying _tkinter.pyd (and perhaps the tcl*.dll and tk*.dll) files from C:\Python26\DLLs to C:\Program Files\Sublime Text 2 (making sure you’re copying from the 64 bit version of Python if you’re using the 64 bit version of Sublime Text 2
- Copying C:\Python26\lib\lib-tk to your package directory, so that it’ll be found when you import the modules.[/code]
Unpack this Zip into your Packages directory. If someone can get this to work you’ll be a leg-end.
I Made a plugin that does pretty much what TextMate did
check out github.com/jnordberg/sublime-colorpick
Looks pretty sweet!
Two things:
I had to change line 17 from:
args = [path.join(sublime.packages_path(), 'ColorPick', 'bin', 'colorpick')]
to
args = [path.join(sublime.packages_path(), 'sublime-colorpick', 'bin', 'colorpick')]
because the default folder name when you check out the repo is the repo name,
and I had to chmod +x the colorpick binary.
Works great. One thing I noticed though: when the color panel is open, Sublime seems to stall until I close the colorpicker (gives me the SBBOD…) Other than that its seems great.
Ah, so close! A few things:
- I added this simple bit to handle 3-color hex shorthand:
if len(selected) == 3:
selected += selected
-
A bigger problem: if I close the Color Picker instead of clicking “Pick!” it goes into beachball and I have to force-quit ST2.
-
Is it just me, or does it always open in HSB Sliders mode? It would be great if you could set that with something like /bin/colorpick -startPanel HexPicker or -startPanel ColorWheel. Not at all sure if that’s even possible, but it would be really helpful.
I would love to have this functionality working like TM, thanks for getting this started.
Oh
I get this error:
Traceback (most recent call last):
File "./sublime_plugin.py", line 282, in run_
File "./ColorPick.py", line 21, in run
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
Glad you guys like it
Nice, i gladly accept pull requests on github
- A bigger problem: if I close the Color Picker instead of clicking “Pick!” it goes into beachball and I have to force-quit ST2.
See github.com/jnordberg/color-pick/issues/1
[quote=“natebeaty”]
3. Is it just me, or does it always open in HSB Sliders mode? It would be great if you could set that with something like /bin/colorpick -startPanel HexPicker or -startPanel ColorWheel. Not at all sure if that’s even possible, but it would be really helpful.
I would love to have this functionality working like TM, thanks for getting this started.[/quote]
Yeah, i hardcoded it like that since thats the mode i’m using myself Cocoa’s NSColorPanel allows you to set modes, i should make the binary remember what mode was last used and start up using that.
Oh, and please make an issue on the github page if you have any problems or feature requests.
[quote=“jbrooksuk”]Oh
I get this error:
Traceback (most recent call last):
File "./sublime_plugin.py", line 282, in run_
File "./ColorPick.py", line 21, in run
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
[/quote]
You have to chmod +x the executable (sublime-colorpick/bin/colorpick).
[quote=“jeffory”]Windows version (needs Powershell):
github.com/jeffory/ST2-Color-Picker[/quote]
If you have not used Powershell before, you have to start the command interface ( on Windows 7 just write powershell in the search box from the Start Menu ) and write in it the following code :
Set-ExecutionPolicy RemoteSigned
After that, Powershell should be available for use, and the Colour Picker should work.
This happens because Powershell is blocked by default ( you can’t run any code ).
For more details visit : http://technet.microsoft.com/en-us/library/ee176949.aspx