Yup,
+1 !
It would help with these enormous CSS files i have been working on.
Thanks !
Yup,
+1 !
It would help with these enormous CSS files i have been working on.
Thanks !
If I could get Tkinter and tkColorChoose to import properly, I think this will do exactly what everyone is after!
[code]import sublime, sublime_plugin
from Tkinter import *
from tkColorChooser import askcolor
class ColorPicker(sublime_plugin.WindowCommand):
def run(self):
getBgColor(self)
def getBgColor(self):
(triple, hexstr) = askColor()
if hexstr:
try:
if self.window.active_view():
self.window.active_view().run_command(“insert_hex”, {“hex” : hexstr})
except ValueError:
pass
class InsertHex(sublime_plugin.TextCommand):
def run(self, edit, hex):
self.view.replace(edit, region, str(hex))[/code]
Running getBgColor() without the Sublime functions produces the color picker, but as soon as it becomes a plugin, the module is no longer imported
Edit: Fixed indent issue, but still no Tkinter import
The Tkinter modules aren’t included in the version of Python distributed with Sublime Text to save on download size - I assumed no one would want to use it
If that Tkinter code works as advertised, I’d gladly take a slightly heavier binary. Having a color chooser available would be a huge help in editing CSS in ST2.
Is it possible to provide an additional download that could add Tkinter to the default install (maybe with a sublime-package file)? I personally have no need for a colour picker but would appreciate having Tkinter available for other plugins
Please, please, oh please include Tkinter!
The things we could make from it would be amazing!
I desperately need a colour picker and my plugin would be final with Tkinter installed.
I’d need to fix the colour code insertion since I gave up when I found out Tkinter isn’t included.
But it would take two minutes to fix it
Any word on this, after purchasing this is probably the one thing that gave me frowny face
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=“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
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.