Add some more Sublime snippets.
This commit is contained in:
parent
e3b2cd6d1d
commit
10227715d7
5 changed files with 125 additions and 0 deletions
10
SublimeSnippets/systemoutprintln.sublime-snippet
Normal file
10
SublimeSnippets/systemoutprintln.sublime-snippet
Normal file
|
@ -0,0 +1,10 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
System.out.println($1);$0
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
<tabTrigger>sysout</tabTrigger>
|
||||
</snippet>
|
27
SublimeSnippets/tkinter_geometry.sublime-snippet
Normal file
27
SublimeSnippets/tkinter_geometry.sublime-snippet
Normal file
|
@ -0,0 +1,27 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
self.windowtitle = 'Window'
|
||||
|
||||
self.t = tkinter.Tk()
|
||||
self.t.title(self.windowtitle)
|
||||
self.w = 800
|
||||
self.h = 525
|
||||
self.screenwidth = self.t.winfo_screenwidth()
|
||||
self.screenheight = self.t.winfo_screenheight()
|
||||
self.windowwidth = self.w
|
||||
self.windowheight = self.h
|
||||
self.windowx = (self.screenwidth-self.windowwidth) / 2
|
||||
self.windowy = ((self.screenheight-self.windowheight) / 2) - 27
|
||||
self.geometrystring = '%dx%d+%d+%d' % (self.windowwidth, self.windowheight, self.windowx, self.windowy)
|
||||
self.t.geometry(self.geometrystring)
|
||||
|
||||
self.build_gui_manager()
|
||||
|
||||
self.t.mainloop()
|
||||
]]></content>
|
||||
<tabTrigger>tkgeometry</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
43
SublimeSnippets/tkinter_scrollframe.sublime-snippet
Normal file
43
SublimeSnippets/tkinter_scrollframe.sublime-snippet
Normal file
|
@ -0,0 +1,43 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
import tkinter
|
||||
|
||||
class ScrollingFrame:
|
||||
def __init__(self, t):
|
||||
self.t = t
|
||||
self.frame_primary = tkinter.Frame(t)
|
||||
#self.frame_primary.pack(expand=True, fill='both')
|
||||
self.canvas = tkinter.Canvas(self.frame_primary)
|
||||
self.frame_inner = tkinter.Frame(self.canvas)
|
||||
|
||||
self.scrollbar = tkinter.Scrollbar(self.frame_primary, orient='vertical', command=self.canvas.yview)
|
||||
self.canvas.configure(yscrollcommand=self.scrollbar.set)
|
||||
|
||||
self.scrollbar.pack(side='right', fill='y')
|
||||
self.canvas.pack(expand=True, fill='both')
|
||||
self.canvas.create_window((0, 0), window=self.frame_inner, anchor='nw')
|
||||
|
||||
def frame_inner_fix(*event):
|
||||
children = self.frame_inner.winfo_children()
|
||||
if len(children) == 0:
|
||||
w = 25
|
||||
else:
|
||||
w = max(item.winfo_width() for item in children)
|
||||
h = self.t.winfo_height()
|
||||
self.canvas.configure(scrollregion=self.canvas.bbox("all"), width=w, height=h)
|
||||
|
||||
self.frame_inner.fix = frame_inner_fix
|
||||
self.frame_primary.bind('<Configure>', self.frame_inner.fix)
|
||||
|
||||
def pack(self, *args, **kwargs):
|
||||
self.frame_primary.pack(*args, **kwargs)
|
||||
|
||||
def grid(self, *args, **kwargs):
|
||||
self.frame_primary.grid(*args, **kwargs)
|
||||
]]></content>
|
||||
<tabTrigger>tkscrollframe</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
35
SublimeSnippets/tkinter_template.sublime-snippet
Normal file
35
SublimeSnippets/tkinter_template.sublime-snippet
Normal file
|
@ -0,0 +1,35 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
import tkinter
|
||||
|
||||
class Application:
|
||||
def __init__(self):
|
||||
self.windowtitle = 'Window'
|
||||
|
||||
self.t = tkinter.Tk()
|
||||
self.t.title(self.windowtitle)
|
||||
w = 800
|
||||
h = 525
|
||||
screenwidth = self.t.winfo_screenwidth()
|
||||
screenheight = self.t.winfo_screenheight()
|
||||
windowwidth = w
|
||||
windowheight = h
|
||||
windowx = (screenwidth-windowwidth) / 2
|
||||
windowy = ((screenheight-windowheight) / 2) - 27
|
||||
self.geometrystring = '%dx%d+%d+%d' % (windowwidth, windowheight, windowx, windowy)
|
||||
self.t.geometry(self.geometrystring)
|
||||
|
||||
self.build_gui_manager()
|
||||
|
||||
def build_gui_manager(self):
|
||||
pass
|
||||
|
||||
def mainloop(self):
|
||||
self.t.mainloop()
|
||||
]]></content>
|
||||
<tabTrigger>tktemplate</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
10
SublimeSnippets/utf-8.sublime-snippet
Normal file
10
SublimeSnippets/utf-8.sublime-snippet
Normal file
|
@ -0,0 +1,10 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
utf-8
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
<tabTrigger>uu</tabTrigger>
|
||||
</snippet>
|
Loading…
Reference in a new issue