我一直在使用Ubuntu几年,一直在寻找Ubuntu下的开发环境来做一些我脑海中想到的事情。至少可以找到一个我感到满意的综合环境,这一直令人沮丧。然后,最近我发现了Ubuntu Quickly,并认为它看起来不错,特别是来自Windows MS Access,VBA背景的人。所以我放弃了它,并在几天后使用了DesktopCouch创建了我的第一个应用程序。Ubuntu快速PyGTK和Glade3
然后我发现DesktopCouch不再受青睐,但不想去我的小应用程序的SQL,并决定使用KirbyBase,一切都走得如此之远。
我已经去转换(见屏幕截图)的一个很好的方式,但对于我的生活我无法让我的头围绕对话框屏幕。我在运行应用程序时会显示图像中的图像,但直到用户单击添加或编辑按钮时才会显示图像。
我一直在尝试获取语法来显示,或显示对话框窗口,当按钮被点击三天,我只是无法得到它。
我试着将它设置为一个独立的Ui文件,如关于和首选项,但这只是让我更困惑。
我认为答案很可能很明显,但三天后我需要帮助。到目前为止,主窗口的代码也被附加,并且在OnAddSlang过程中我想要显示对话框,收集数据或以其他方式。
顺便说一下,我也是Python的新手。
感谢您提前给予的帮助。
迈克尔![ScreenDump
] 1。
enter code here
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
import sys
import os
import gettext
from gettext import gettext as _
gettext.textdomain('ozslang')
import gtk
import logging
logger = logging.getLogger('ozslang')
from kirbybase import KirbyBase, KBError #Set up KirbyBase Database
from ozslang_lib import Window
from ozslang.AboutOzslangDialog import AboutOzslangDialog
from ozslang.PreferencesOzslangDialog import PreferencesOzslangDialog
from ozslang.EntryOzslangDialog import EntryOzslangDialog
FILE_EXT = "tbl"
# See ozslang_lib.Window.py for more details about how this class works
class OzslangWindow(Window):
__gtype_name__ = "OzslangWindow"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the main window"""
super(OzslangWindow, self).finish_initializing(builder)
self.AboutDialog = AboutOzslangDialog
self.PreferencesDialog = PreferencesOzslangDialog
# Code for other initialization actions should be added here.
# Set up KirbyBase Database - Check if Created if not Create it
# Otherwise Check Read it and Print out Results.
db = KirbyBase()
dbTable = "slang.tbl"
# Table has Record No, Slang, Meaning, Useage, Is Common, Locality and Comment.
# Fields are Integer, String, String, String, Boolean, String and String.
# Check if the table exists.
if os.path.exists('slang.tbl'):
boolIsCreated = True
print boolIsCreated
#recno = db.insert(dbTable, ['Pie Hole', 'Mouth', 'Shut your pie hole', True, 'Australia Wide', 'No Comments 2'])
result = db.select('slang.tbl', ['recno'], ['*'])
print result
barMsg = 'Slang Table is in current directory'
self.statusbar = builder.get_object("statusbar1")
self.statusbar_cid = self.statusbar.get_context_id("Status")
self.statusbar.push(self.statusbar_cid, barMsg)
else:
#If it does not exist in this location, create it.
result = db.create('slang.tbl', ['slang:str', 'meaning:str', 'use:str',
'iscommon:bool', 'locality:str', 'comment:str'])
print 'Slang Table Created'
barMsg = 'Slang Table Created'
self.statusbar = builder.get_object("statusbar1")
self.statusbar_cid = self.statusbar.get_context_id("Status")
self.statusbar.push(self.statusbar_cid, barMsg)
print 'at end of slang table open create'
def on_EditSlang(self, widget):
"""Called when the user wants to edit a wine entry"""
print "In Edit Function"
pass_
def OnAddSlang(self, widget):
print 'In Add Function'
#Called when the use wants to add a slang
EntryOzslangDialog.hasfocus = True
print 'after dialog...'
def on_btnOK_clicked(self,widget):
pass
def on_btnCancel_clicked(self,widget):
pass
def _on_close(self, window):
pass