Tkinterでwindowとボタンを作り、ボタンが押されたらそのwindowを消し、wxpythonで新しくwindowを
作りたいのですが実行すると一瞬何かが開いて何も起きません。
そもそもそんなことできないのでしょうか?
コードの改善点や他の良い方法があったら教えてください。
macOs10.12.6
python2.7
wxPython4.0.0b1
#!/usr/bin/python # -*- coding: utf-8 -*- import wx import random import sys import Tkinter class Tkinter(object): def __init__(self): self.wxpytho = wxpython(None, title = 'Wxpython-window') tkinter() def start(self): self.wxpython.initFrame() root.destroy() def tkinter(self): root = Tkinter.Tk() #window作成 root.title(u"Tkinter-window") root.geometry("425x850") #ボタン Button = Tkinter.Button(text=u'START', width = 100) Button.bind("<Button-1>", start) Button.pack() center(root) root.mainloop() class Wxpython(wx.Frame): def __init__(self, parent, title): #新window作成 wx.Frame.__init__(self, parent, title = title, size = (425, 850)) def initFrame(self): self.Centre() #画面中央に配置 self.Show(True) app = wx.App() Tkinter() app.MainLoop()
あなたの回答
tips
プレビュー