我正在使用PyInstaller 2.1"编译"我的Windows Python应用程序.我最初尝试使用onefile模式,但onefile需要很长时间才能启动(解压缩wx和matplotlib).使用该onedir模式它非常快(仅比原生python慢一点).
所以我想使用onedir模式,更快的启动时间,但是对于最终用户很难找到实际*.exe位于主目录中的文件的数量巨大的内部文件(有98个文件,包括实际的可执行文件,它的表现).
我想,以确保非精通技术的用户可以很容易地不长的声明"双击"的可执行文件和工作与本程序(方便和便携性),以"不理会"的97个其他文件存在.
是否可以将所有那些"令人分心"的文件移动到子文件夹中?或者还有其他方法可以让最终用户轻松运行此程序吗?
这就是我想要做的事情:
在文档中搜索包含RegEx的模式,然后检查这个确切的模式是否在一行内存在两次.
Content of file.xml:
(some code) "testen" (more code) >testete<
(some code) "bleiben" (more code) >bleiben<
(some code) "stehen" (more code) >stand<
(some code) "hängen" (more code) >hängten<
...
Run Code Online (Sandbox Code Playgroud)
现在我想检查.*en并检查(确切)相同的单词是否在该行中出现两次.所以结果应该是:
bleiben
Run Code Online (Sandbox Code Playgroud)
因为Testen!= testete,stehen!= stand,hängen!=hängten
有没有办法做到这一点?
因为我在这里找不到任何东西,所以我试着提出我的问题.
我正试图在kivy中构建一个简单的节拍器.我基本上采用了随安装提供的音频示例,并希望添加一个节拍器功能.
class AudioButton(ToggleButton):
filename = StringProperty(None)
sound = ObjectProperty(None)
def on_filename(self, instance, value):
# the first time that the filename is set, we are loading the sample
if self.sound is None:
self.sound = SoundLoader.load(value)
def on_press(self):
# stop the sound if it's currently playing
if self.sound.status != 'stop':
self.sound.stop()
self.sound.play()
Run Code Online (Sandbox Code Playgroud)
如您所见,我将课程从更改Button为ToggleButton.
我试图用一个while循环self.sound.play(),但结果是无穷大,所以基本上我正在寻找一种方法来摆脱循环,如果我再次按下按钮.
我没有真正理解文档中的事件循环管理,我认为应该是答案,但我之前从未使用过事件循环.如果有人可以为这种情况提供一些示例代码,那就太好了.