本文整理汇总了Python中twisted.internet.tksupport.install函数的典型用法代码示例。如果您正苦于以下问题:Python install函数的具体用法?Python install怎么用?Python install使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了install函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
root = self.root = Tk()
root.wm_title('xcons')
# Link Tk into twisted main loop
tksupport.install(root)
# Create menu bar
mbar = Frame(root)
mbar.pack(side=TOP, fill=X)
if mbar:
mb_console = Menubutton(mbar, text='Console', underline=0)
if mb_console:
menu = mb_console['menu'] = Menu(mb_console, tearoff=0)
# menu.add_command(label='Connect...', underline=0)
menu.add_command(label='Exit', underline=1,
command=root.quit)
mb_console.pack(side=LEFT)
status = self.status = Label(root)
status.pack(side=BOTTOM, anchor=W)
# Create text area
#xsc = Scrollbar(root, orient=HORIZONTAL)
ysc = Scrollbar(root)
text = self.text = Text(root,
font='jet-small-fixed',
yscrollcommand=ysc.set)
ysc.config(command=text.yview)
ysc.pack(side=RIGHT, fill=Y)
text.pack(side=TOP, fill=BOTH)
text.bind('<KeyPress>', self.keypress)
示例2: optionView
def optionView(self):
tksupport.install(self.top)
self.top.title('Chat')
self.top.geometry( '700x680' )
def callback():
self.stop()
self.top.protocol("WM_DELETE_WINDOW", callback)
optionView = Frame(self.top)
optionView.pack()
MyButton = partial(Button, optionView, text='Host a server', command=self.serverView)
chooseServer = MyButton()
chooseServer.pack()
chooseClient = MyButton(text='Connect to a server', command=self.clientView)
chooseClient.pack()
quitButton = Button(optionView, text='QUIT',command=self.stop)
quitButton.pack()
self.pages['optionView'] = optionView
self.current = 'optionView'
reactor.run()
示例3: run
def run():
import sys
opt = Options()
opt.parseOptions(sys.argv[1:])
delay = int(opt["delay"])
if opt["proxy"]:
host = urlparse.urlparse(opt["proxy"])[1]
if ":" in host:
host, port = host.split(":", 1)
port = int(port)
else:
port = 80
makeChecker = lambda url, notified: monitor.ProxyChangeChecker(host, port, notified, url, delay)
else:
makeChecker = lambda url, notified: monitor.ChangeChecker(notified, url, delay)
from twisted.internet import reactor, tksupport
root = Tk.Tk()
root.protocol("WM_DELETE_WINDOW", reactor.stop)
root.title("Web Monitor")
tksupport.install(root)
frame = webmonFrame(root, makeChecker, opt.urls)
frame.pack()
reactor.run()
示例4: main
def main():
root = Tk()
root.title('BSE Client')
root.geometry("600x670")
root.pack_propagate(0)
ui = UI(root)
tksupport.install(root)
reactor.run()
示例5: __init__
def __init__(self, ip="localhost"):
self.window = Tk()
self.canvas = Canvas(self.window, {"height": 700, "width": 1200})
self.canvas.grid(column=0, row=0, sticky=(N, W))
self.game_board = None
point = TCP4ClientEndpoint(reactor, ip, 1079)
d = point.connect(ObserverProtocolFactory(self.update_board))
tksupport.install(self.window)
reactor.run()
示例6: __init__
def __init__(self, parent):
from Tkinter import Tk, Label, Button
self.parent = parent
self.win = Tk(className='moving')
self.win.overrideredirect(1)
self.win.tkraise()
self.label = Label(self.win, text=' '*25, font='fixed')
self.label.pack(padx=20, pady=10)
self.button = Button(self.win, text='OK', command=self.parent.hide)
self.button.pack(pady=5)
tksupport.install(self.win)
示例7: run
def run():
global button
global osc_sender
osc_sender = UDPSenderApplication(OSC_SEND_PORT, OSC_SEND_HOST)
root = Tkinter.Tk()
root.wm_title("Color picker osc.udp://%s:%s" % (OSC_SEND_HOST, OSC_SEND_PORT))
button = Tkinter.Button(root, text='Set Background Color',
command=set_color)
button.config(height=3, font=('times', 20, 'bold'))
button.pack(expand=Tkinter.YES, fill=Tkinter.BOTH)
tksupport.install(root)
reactor.run()
示例8: _start_root
def _start_root(self):
if os.name == "nt":
button_foreground = "#104639"
lookup_button_padding = 10
else:
button_foreground = "#FFFFFF"
lookup_button_padding = 11
root = tk.Tk()
root.resizable(0, 0)
root.wm_title("LBRY")
tksupport.install(root)
if os.name == "nt":
root.iconbitmap(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])),
"lbrynet", "lbrynet_downloader_gui", "lbry-dark-icon.ico"))
else:
root.wm_iconbitmap("@" + os.path.join(os.path.dirname(__file__), "lbry-dark-icon.xbm"))
root.button_font = tkFont.Font(size=9)
ttk.Style().configure(".", background="#FFFFFF")
ttk.Style().configure("LBRY.TButton", background="#104639", foreground=button_foreground,
borderwidth=1, relief="solid", font=root.button_font)
ttk.Style().map("LBRY.TButton",
background=[('pressed', "#104639"),
('active', "#104639")])
#ttk.Style().configure("LBRY.TButton.border", background="#808080")
ttk.Style().configure("Lookup.LBRY.TButton", padding=lookup_button_padding)
ttk.Style().configure("Stop.TButton", padding=1, background="#FFFFFF", relief="flat", borderwidth=0)
ttk.Style().configure("TEntry", padding=11)
ttk.Style().configure("Float.TEntry", padding=2)
#ttk.Style().configure("A.TFrame", background="red")
#ttk.Style().configure("B.TFrame", background="green")
#ttk.Style().configure("B2.TFrame", background="#80FF80")
#ttk.Style().configure("C.TFrame", background="orange")
#ttk.Style().configure("D.TFrame", background="blue")
#ttk.Style().configure("E.TFrame", background="yellow")
#ttk.Style().configure("F.TFrame", background="#808080")
#ttk.Style().configure("G.TFrame", background="#FF80FF")
#ttk.Style().configure("H.TFrame", background="#0080FF")
#ttk.Style().configure("LBRY.TProgressbar", background="#104639", orient="horizontal", thickness=5)
#ttk.Style().configure("LBRY.TProgressbar")
#ttk.Style().layout("Horizontal.LBRY.TProgressbar", ttk.Style().layout("Horizontal.TProgressbar"))
root.configure(background="#FFFFFF")
root.protocol("WM_DELETE_WINDOW", self.stop)
self.master = root
示例9: setup_window
def setup_window(title = "Turtles"):
#setup canvas and make it play nicely with Twisted
root = Tkinter.Tk()
canvas = Tkinter.Canvas(root,width=WINDOW_WIDTH,height=WINDOW_HEIGHT)
canvas.pack(side = Tkinter.LEFT)
tksupport.install(root)
root.title(title)
draw_headings(canvas)
root.protocol('WM_DELETE_WINDOW', reactor.stop)
return canvas
示例10: __init__
def __init__(self):
self.window = Tk()
self.canvas = Canvas(self.window, { "height": 700, "width": 1450 })
self.canvas.grid(column = 0, row = 0, sticky=(N, W))
self.game_board = None
self.actions = None
self.simulator_screen = None
point = TCP4ClientEndpoint(reactor, "localhost", 1079)
d = point.connect(PlayerProtocolFactory(self.update_game))
d.addCallback(self.got_protocol)
tksupport.install(self.window)
reactor.run()
示例11: main
def main():
root = Tk()
# Install the Reactor support
tksupport.install(root)
# at this point build Tk app as usual using the root object,
# and start the program with "reactor.run()", and stop it
# with "reactor.stop()".
app = App(root)
root.mainloop()
root.destroy() # optional; see description below
示例12: main
def main():
from twisted.python import log
log.startLogging(sys.stdout)
symbol = Symbol.X
if len(sys.argv) > 1:
arg = sys.argv[1].strip().lower()
symbol = Symbol.X if arg == 'x' else Symbol.O
log.msg('The symbol for the human player is ', symbol)
app = App(None, symbol)
app.eval('tk::PlaceWindow %s center' % app.winfo_pathname(app.winfo_id()))
tksupport.install(app)
reactor.run()
示例13: run
def run():
global menu, options, frame
args = sys.argv[1:]
if '-l' in args: # cvs is an idiot
i = args.index('-l')
args = args[i:i+2]+args
del args[i+2:i+4]
for arg in args[:]:
try:
i = args.index(arg)
if arg[:2] == '-o' and args[i+1][0]!='-':
args[i:i+2] = [] # suck on it scp
except ValueError:
pass
root = Tkinter.Tk()
root.withdraw()
top = Tkinter.Toplevel()
menu = TkConchMenu(top)
menu.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
options = GeneralOptions()
try:
options.parseOptions(args)
except usage.UsageError as u:
print('ERROR: %s' % u)
options.opt_help()
sys.exit(1)
for k,v in options.items():
if v and hasattr(menu, k):
getattr(menu,k).insert(Tkinter.END, v)
for (p, (rh, rp)) in options.localForwards:
menu.forwards.insert(Tkinter.END, 'L:%s:%s:%s' % (p, rh, rp))
options.localForwards = []
for (p, (rh, rp)) in options.remoteForwards:
menu.forwards.insert(Tkinter.END, 'R:%s:%s:%s' % (p, rh, rp))
options.remoteForwards = []
frame = tkvt100.VT100Frame(root, callback=None)
root.geometry('%dx%d'%(tkvt100.fontWidth*frame.width+3, tkvt100.fontHeight*frame.height+3))
frame.pack(side = Tkinter.TOP)
tksupport.install(root)
root.withdraw()
if (options['host'] and options['user']) or '@' in options['host']:
menu.doConnect()
else:
top.mainloop()
reactor.run()
sys.exit(exitStatus)
示例14: make_client
def make_client():
root = tk.Tk()
root.title('Tkwidgets application')
login_window = LoginWindow(root)
factory = ClientFactory(
root,
on_connect=functools.partial(setattr, login_window, 'handle'),
on_login=login_window.lock,
on_logout=login_window.unlock
)
reactor.connectTCP('localhost', STANDARD_PORT, factory)
tksupport.install(root)
reactor.run()
示例15: main
def main():
logging.basicConfig(
filename="client.log",
level=logging.INFO,
format="%(asctime)s - %(name)s - %(thread)d - %(levelname)s - %(message)s",
datefmt="%m/%d/%Y %I:%M:%S %p",
)
root = Tk()
root.protocol("WM_DELETE_WINDOW", lambda: on_closing(root, reactor))
# Install the Reactor support
tksupport.install(root)
# set rez
root.geometry(rez)
root.wm_title(title)
# create app obj
app = Application(reactor, master=root)
# main loop from
reactor.run()