我的复选框C1
未显示并导致问题永远不会完成。这里发生了什么?
from Tkinter import *
class LabeledEntry(Frame):
def __init__(self, parent, *args, **kargs):
text = kargs.pop("text")
Frame.__init__(self, parent)
Label(self, text=text, justify=LEFT).grid(sticky=W, column=0, row=0)
Entry(self, *args, **kargs).grid(sticky=E, column=1, row=0)
class User_Input:
def __init__(self, parent, fields):
GUIFrame = Frame(parent)
GUIFrame.pack(expand=True, anchor=NW)
field_index = 1
for field in fields:
self.field = LabeledEntry(GUIFrame, text=field)
self.field.grid(column=0, row=field_index, pady=1)
self.field.grid_columnconfigure(index = 0, minsize = 150)
field_index += 1
CheckVar1 = IntVar()
self.C1 = Checkbutton(parent, text = "checkbox1", variable = CheckVar1, onvalue = 1, offvalue = 0)
self.C1.grid(column=2, row=2)
fields = ['Entry Box 1:', 'Entry Box 2']
root = Tk()
MainFrame = User_Input(root, fields)
root.mainloop()
答案 0 :(得分:2)
尝试将.grid
上的C1
来电更改为.pack(anchor = W)
。您已经在pack
框架上使用了parent
(使用GUIFrame),因此Tkinter将很乐意等待您尝试决定使用哪个布局管理器。
from Tkinter import *
class LabeledEntry(Frame):
def __init__(self, parent, *args, **kargs):
text = kargs.pop("text")
Frame.__init__(self, parent)
Label(self, text=text, justify=LEFT).grid(sticky=W, column=0, row=0)
Entry(self, *args, **kargs).grid(sticky=E, column=1, row=0)
class User_Input:
def __init__(self, parent, fields):
GUIFrame = Frame(parent)
GUIFrame.pack(expand=True, anchor=NW)
field_index = 1
for field in fields:
self.field = LabeledEntry(GUIFrame, text=field)
self.field.grid(column=0, row=field_index, pady=1)
self.field.grid_columnconfigure(index = 0, minsize = 150)
field_index += 1
CheckVar1 = IntVar()
self.C1 = Checkbutton(parent, text = "checkbox1", variable = CheckVar1, onvalue = 1, offvalue = 0)
self.C1.pack(anchor = W)
fields = ['Entry Box 1:', 'Entry Box 2']
root = Tk()
MainFrame = User_Input(root, fields)
root.mainloop()
答案 1 :(得分:0)
尝试使用Frame和root创建它,因此将Array
(
[0] => stdClass Object
(
[id] => 226
[city] => Dhaka
)
[1] => stdClass Object
(
[id] => 228
[city] => Charleston County
)
[2] => stdClass Object
(
[id] => 229
[city] => Dhaka
)
[3] => stdClass Object
(
[id] => 232
[city] => Dhaka
)
[4] => stdClass Object
(
[id] => 234
[city] => Miami-Dade County
)
替换为let client: MSClient = MSClient(applicationURLString: "https://yoururl.azure-mobile.net/", applicationKey: "yourApplicationKey")
client.push.registerNativeWithDeviceToken(deviceToken, tags: nil, completion: {(error) -> Void in
if error != nil{
NSLog("Error registering for notifications: %@", error)
}
})