wxpython

embedding wxPython in VisualStudio 2005 C/C++ fails

霸气de小男生 提交于 2019-12-25 00:03:17
问题 When I try to embed python wx in C like this: #include "stdafx.h" #ifdef _DEBUG #undef _DEBUG #include <Python.h> #define _DEBUG #else #include <Python.h> #endif int _tmain(int argc, _TCHAR* argv[]) { PyObject* pyModule; Py_Initialize(); //_pyModule = PyImport_ImportModule("__main__"); //_pyModule = PyImport_ImportModule("csi"); pyModule = PyImport_ImportModule("wx"); if(!pyModule) PyErr_Print(); return 0; } it fails: ->Traceback (most recent call last): File "C:\Python27\lib\site-packages\wx

wxpython message dialog right to left

三世轮回 提交于 2019-12-24 20:18:51
问题 i am using this command, which should switch my layout to RTL but the message dialog is still LTR: self.SetLayoutDirection(wx.Layout_RightToLeft) message dialog: FinishMessage=wx.MessageDialog(self, "הבדיקה הסתיימה\r\n התוצאות נמצאות בקובץ אקסל במיקום הקובץ", caption="סיום בדיקת ניחות",style=wx.OK) how do i fix the text will be right to left? 来源: https://stackoverflow.com/questions/47246408/wxpython-message-dialog-right-to-left

How to delete page of AuiNotebook?

天大地大妈咪最大 提交于 2019-12-24 19:35:04
问题 I created frame with AuiNotebook and redefine EVT_AUINOTEBOOK_PAGE_CLOSE event where DeletePage is called: def OnAuiNotebookPageClose( self, event ): auinotebook = event.GetEventObject() page_idx = event.GetSelection() auinotebook.DeletePage(page_idx) On click the "X" button on the page the event is invoked, but DeletePage always returned False, page was not removed... What is wrong in my code? Please see my code below. import wx import wx.xrc import wx.aui class Frame1 ( wx.Frame ): def _

Global variable between frames in wxPython

烈酒焚心 提交于 2019-12-24 16:35:33
问题 I wanted to use a variable defined in a child frame. I can't figure out how to pull back the username after a successful login event in the child frame back to the main frame. I wanted to update the static label to show the username. import wx import MySQLdb import sys username = "" class MainFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, title = 'Application Title',style = wx.SYSTEM_MENU) panel = wx.Panel(self) menubar = wx.MenuBar() panel.SetBackgroundColour(

wxPython gives different results on Windows and Ubuntu

半世苍凉 提交于 2019-12-24 16:14:15
问题 I have developed a small wxPython program that gives radically different output in Windows and Ubuntu (I am more than happy to be told I've programmed it incorrectly and I would regard that as a result- provided we can get it to work) The program displays four shapes the right hand side. Double clicking on the right hand images moves them to the left hand side and vice versa. Issues on Windows (see screen shots taken after the same actions in Windows and Ubuntu): The buttons don't render

Python multiprocessing and wxPython working together

谁都会走 提交于 2019-12-24 14:12:21
问题 I've got the following problem: I've written a script which is running up to four processes at the same time. Works like a charm when using it via command line. Then I made the decision to write a GUI with wxPython and I was quickly figuring out that the GUI and the script need to run in different processes so both stay usable while the other is doing something. (i.e. being able to press a stop button while the script is running) This is also working perfectly. Now the problem: I just cannot

wxPython/ReportLab: How to create and open a .pdf file on button clicked

不羁岁月 提交于 2019-12-24 12:43:50
问题 Good day all, For about 3days I have been trying hardest to get my way around this! I have a perfectly working wxFrame as well as a perfectly working ReportLab pdf script. See the code files below respectively (Note: data1.py is the GUI while data2.py is the running pdf script). My problems are:- 1) I want the pdf script to run only after I press the “Save To PDF” button 2) The value of the name field (as stored in a variable “NameString”) should be added to the generated pdf file. At the

wxPython: How to bind the button?

房东的猫 提交于 2019-12-24 12:33:37
问题 I just started with wxPython and have problems with the binding. Usually the examples I find to bind a button event are done with self.Bind(wx.EVT_BUTTON, self.OnWhatEverFunction, button) . I have a frame with a panel inside and a button and what ever I tried, the outcome is always a flashing frame that appears in a split second and that's it. Since the code isn't that much I attach it here and hope one of you can show me the way out of my little problem. Thanks in advance, Thomas #!/usr/bin

Changing Size of Grid when grid data is changed

旧巷老猫 提交于 2019-12-24 11:46:35
问题 I'm having trouble updating a wx grid after it's initially created in Python. I'm following the steps located here: http://wiki.wxpython.org/wxGrid but for some reason the grid is not being displayed correctly. The rows keep on being added and added, despite if the data grows or shrinks. Here is the code. Clicking the refresh button re-initializes the data that the grid is supposed to display. The bug (I think) is in the function refreshGrid, but I can't figure out what is causing it! import

How do I make a find dialog in StyledTextCtrl?

柔情痞子 提交于 2019-12-24 11:27:56
问题 There is an existing question on this subject: Find text dialog with wxpython, but it's in TextCtrl. So I changed the TextCtrl to StyledTextCtrl, and tested it. But I got this error: in wxStyledTextCtrl::SetStyle(): not implemented How do I make the SetStyle a selection instead so that you can click away? Here is my code: import wx import wx.stc as stc class MyFrame(wx.Frame): def __init__(self, *args, **kwds): kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self