0
콤보 상자 (ComboBox)가 포함 된 매우 간단한 PyGTK 응용 프로그램이 있습니다. 어떤 이유로 Python 스크립트를 실행할 때 ComboBox가 표시되지 않습니다. 기본 창은 ComboBox가 아닌 볼 수 있습니다. 참고 성공적으로 ComboBox가 있고 그것이 기본 창에 추가되었음을 성공적으로 확인했습니다 (위젯을 상자에 추가 한 다음 기본 창에 추가 함).PyGTK 콤보 상자가 보이지 않습니다.
내 ComboBox를 표시하려면 어떻게해야합니까?
import pygtk
pygtk.require('2.0')
import gtk
class MainApp:
def __init__(self):
self.encryptFile = True
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
main_box = gtk.VBox(True, 10)
client_store = gtk.ListStore(str)
self.clientFiles = ("a","b","c")
for f in self.clientFiles:
client_store.append([f])
combobox = gtk.ComboBox(client_store)
renderer_text = gtk.CellRendererText()
combobox.pack_start(renderer_text, True)
combobox.add_attribute(renderer_text, "text", 0)
combobox.set_size_request(200,25)
main_box.pack_start(combobox)
main_box.show()
self.window.add(main_box)
self.window.show()
def main(self):
gtk.main()
def delete_event(self, widget, event, data=None):
return False
def destroy(self, widget, data=None):
gtk.main_quit()
if __name__ == "__main__":
app = MainApp()
app.main()
감사합니다. – Mack