wxpython

wxPython how to set widget position inside statusbar

有些话、适合烂在心里 提交于 2020-01-06 05:33:07
问题 I would like to add two buttons inside the status bar, and I have them implemented as follows: import wx class MainFrame(wx.Frame): """Constructor""" def __init__(self, parent, id): wx.Frame.__init__(self, None) # self.status_bar = self.CreateStatusBar(3) self.status_bar = self.CreateStatusBar(3) self.status_bar.SetStatusText("some text", 0) self.button1 = wx.Button(self.status_bar, -1, "button 1") self.button2 = wx.Button(self.status_bar, -1, "button 2") self.status_bar.SetStatusWidths([-1,

rectangle wont show up on wxpython

依然范特西╮ 提交于 2020-01-06 05:04:30
问题 The rectangle won't show up for me on a windows computer. I gave this to someone else who was a mac user and the rectangle showed up. I am not receiving any errors so I can't seem to figure this out. I am using python 2.7.7. import socket import wx class WindowFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title = title, size=(500, 400)) self.panel=wx.Panel(self) self.panel.SetBackgroundColour("#E6E6E6") self.control = wx.TextCtrl(self.panel, style = wx.TE

rectangle wont show up on wxpython

半腔热情 提交于 2020-01-06 05:03:04
问题 The rectangle won't show up for me on a windows computer. I gave this to someone else who was a mac user and the rectangle showed up. I am not receiving any errors so I can't seem to figure this out. I am using python 2.7.7. import socket import wx class WindowFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title = title, size=(500, 400)) self.panel=wx.Panel(self) self.panel.SetBackgroundColour("#E6E6E6") self.control = wx.TextCtrl(self.panel, style = wx.TE

how to hide the Vertical and horizontal Scrollbars with wxPython ?

大憨熊 提交于 2020-01-06 03:57:25
问题 Am using this code to create a text window but i didn't figure out how to hide the Scrollbars I saw some answers that wxpython doesn't support that , so any ideas ?? thanks! Note:Hiding the scrollbar not disabling the scrolling Thanks :) import wx import wx.lib.dialogs import wx.stc as stc faces = {'times':'Times New Roman','helv':"Arial","size":18} class MainWindow(wx.Frame): def __init__(self,parent,title): self.filepath ='' self.leftMarginWidth = 25 wx.Frame.__init__(self,parent,title

How do I make my Find dialog not interfere with lexer in StyledTextCtrl?

这一生的挚爱 提交于 2020-01-06 01:18:11
问题 I need help in making my find dialog not interfere with my lexer. I used the find dialog in this question but it uses SetStyles which interferes with my lexer. Along with messing up the syntax highlighting, when I try to do the Find again, it just highlights random things. Any help is appreciated! Editor: import wx import wx.stc as stc import keyword class MyFrame(wx.Frame): def __init__(self, *args, **kwds): kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self

wxpython 例子

本小妞迷上赌 提交于 2020-01-05 20:18:39
#!/usr/bin/env python #coding:utf-8 import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"My Frame",size=(300,300)) panel = wx.Panel(self,-1) panel.Bind(wx.EVT_MOTION,self.OnMove) wx.StaticText(panel,-1,"Pos:",pos=(10,12)) self.posCtrl = wx.TextCtrl(panel,-1,"",pos=(40,10)) def OnMove(self,event): pos = event.GetPosition() self.posCtrl.SetValue("%s,%s" % (pos.x,pos.y)) if __name__ == '__main__': app = wx.PySimpleApp() frame = MyFrame() frame.Show(True) app.MainLoop() 来源: https://www.cnblogs.com/quqiufeng/archive/2011/11/08/2240839.html

wxpython中设置radiobox相关使用

∥☆過路亽.° 提交于 2020-01-05 20:18:05
#coding=utf-8 import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"Wxpython Radiobox 演示",size = (800,600)) panel = wx.Panel(self) #第一种方法使用wx.RadioButton类 #RadioButton(parent, id=ID_ANY, label=EmptyString, # pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=RadioButtonNameStr) self.check1 = wx.RadioButton(panel,-1,"Value1",pos = (50,20),style = wx.RB_GROUP) self.check2 = wx.RadioButton(panel, -1, "Value2", pos=(150,20)) self.check3 = wx.RadioButton(panel, -1, "Value3", pos=(250,20)) self.check1.Bind(wx.EVT_RADIOBUTTON,self.Event1)

wxpython 二三事

☆樱花仙子☆ 提交于 2020-01-05 20:17:39
1. 在绘图时,必须定义EVT_PAINT事件的触发处理, self.Bind(wx.EVT_PAINT, self.OnPaint) 对触发处理,只需要建立一个PaintDC(BufferedPaintDC)请求; def OnPaint(self, event): dc = wx.BufferedPaintDC(self, self.buffer) 而真正的绘图通过其他事件激发,或者初始化中定义。 (如果在触发EVT_PAINT中绘图,则将不停调用绘图程序,不能独立控制绘图程序的需求) 2. 如何绘制1个可scroll的图像? wx.Frame — wx.ScrolledWindow –事件处理—- EVT_SCROLLWIN_THUMBRELEASE |– EVT_SCROLLWIN_THUMBTRACK |– EVT_SCROLLWIN_PAGEDOWN |– EVT_SCROLLWIN_PAGEUP 可满足scroll拖曳,点击等鼠标动作; a. 而只对EVT_SCROLLWIN 事件响应,不可取(原因不明); b. 注意,在这里是处理scroll的窗口,而不是scroll bar,所以对于EVT_SCROLL相关事件无响应; c. 而EVT_SCROLLWIN_THUMBRELEASE事件中必须对EVT_SCROLLWIN

wxPython MacOS X Lion full screen mode

点点圈 提交于 2020-01-05 15:08:32
问题 I am making a wxPython application that needs to work in full screen. I want to use the new full screen mode that came in OS X Lion. How can I make the full screen icon appear on the top right corner? 回答1: Until bug #14357 is fixed, there's no direct way to do this using only wxPython functions that I know of. However, you can bypass wxWidgets and access the Cocoa APIs directly to do what you need. Note that you must be using the wxMac/Cocoa bindings (wxPython 2.9 or above). This is the code

wxPython Button Shortcut Accelerator How to '&spam'

烈酒焚心 提交于 2020-01-05 12:08:24
问题 How should I go about adding a button shortcut / accelerator? self.newItemButton = wx.Button(self.mainPanel, label='Scan &New Item') Doesn't seem to work on my platform. Python 2.7.3 (default, Sep 26 2013, 20:08:41) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import wx, os >>> wx.version();print(os.system('uname -a&&lsb_release -a')) '2.8.12.1 (gtk2-unicode)' Linux NE-522 3.2.0-53-lowlatency-pae #55-Ubuntu SMP PREEMPT Mon Aug 26 22:52:24